amidknight

amidknight

Member Since 3 Years Ago

Experience Points 9,160
Experience Level 2

840 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 86
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

20 Mar
4 hours ago

amidknight left a reply on Laravel 5.8 Testing W/ Database Must Run One At A Time

Good question. Just to make sure, the tests above are samples, not actuals - just don't want to get bogged down in specific implementations unless it is literally the problem, which I don't think it is...?? Also, this Laravel 5.8.

Anyhow.

I have a real test file with three tests requiring DB connections: tests/Unit/PersonaTest.php - it uses the RefreshDatabase trait.

When all three tests are run:

  1. Fails because it's the one I'm currently working on.
  2. Timeout.
  3. Timeout.

When run individually:

  1. Fails (error) - undefined method
  2. Fails (no error) - retrieving username, which is blank
  3. Fails (error) - undefined method

tests/Unit/UserTest.php - has 3 tests as well.

  1. Passes.
  2. Timeout.
  3. Timeout.

When run individually:

  1. Passes.
  2. Passes.
  3. Passes.

tests/Unit/InvitationTest.php - has 6 tests, none require DB connection.

  1. Passes.
  2. Passes.
  3. Passes.
  4. Passes.
  5. Passes.
  6. Passes.

When run individually - all pass

tests/Unit/CharonTest.php - have 7 tests, none require DB connection.

All pass.

When run individually - all pass.

This is why I'm thinking it's directly tied to the DB connection concept. Let's try a suite that only has one test that requires a DB connection, to be thoroughly.

I will comment out all but one from tests/Unit/UserTest.php.

  1. Passes.

When run individually - passes.

I've actually created a phpunit group to exclude those tests when I run just phpunit. Of course, this causes problems when I actually do break something, hence why I'm here.

From what I'm seeing online it has to do with speed and asynchronous behavior. Like a test is trying to build the DB while the previous one is still tearing it down or something. Hence the recommendations for in-memory and sqlite. I've also read about differences between sqlite and mysql that make me want to be as close to production as possible. I've also read about increasing the timeout in general...none of this last has been tested or verified by me.

I'm hoping for a solution not a workaround that becomes the solution. This may be something that I'm causing or it may be a defect that hasn't been captured because many of us accept workarounds when we find them. All I know is I don't know what's going on and it might be close enough to the metal that it's beyond my depth. (I work from the human to the metal, not the other way around.) Anyway, confused and curious.

18 Mar
2 days ago

amidknight started a new conversation Laravel 5.8 Testing W/ Database Must Run One At A Time

Odd behavior that could be coming from the not doing it correctly place. I'm also not sure what all information would help keep this succinct yet cover the issue - updates will be added ass necessary.

Consider a vanilla Laravel install.

// UserTest.php

class UserTest extends TestCase
{
    use RefreshDatabase;

    public function testOne()
    {
        $user = User::make(['email' => '[email protected]']);
        $user->save();
        $this->assertTrue($user->id == 1);
    }

    public function testTwo()
    {
        $user = User::make(['email' => '[email protected]']);
        $user->save();
        $this->assertTrue($user->id == 1);
    }
}

Running the tests one at a time, they both pass (phpunit --filter=testOne and phpunit --filter=testTwo). Run them sequentially, all but the first will error out with a timeout error (phpunit).

What's going on (I'd really like to understand the why)? And what's the fix?

What I've tried:

  1. Use in-memory SQLite.
  2. Use DatabaseTransactions instead of DatabaseRefresh

Would like to be as close to production-like as possible.

09 Mar
1 week ago

amidknight started a new conversation Laravel Dusk Test Cases In Different Sub-Dir Than Browser

Does this just fall under the "you're doing it wrong" category?

I'm trying to setup browser testing and would like to put the test classes into a different folder than ./tests/Browser. Seems like Laravel doesn't find them or doesn't try to run them.

./tests/Browser/InviteRequestTest.php works fine.

./tests/Invitation/Browser/InviteRequestTest.php does not.

No tests executed.

16 Feb
1 month ago
15 Feb
1 month ago

amidknight left a reply on Multiple Domains W/ Single Laravel Install

Hey!

Thanks for responding.

Interesting idea.

Thanks for the response. Because dump doesn't kill the script is falls through. So, it is getting to the inside content, the Route::get - but not as expected. I figured it would only get inside the one with the corresponding domain main. In other words, if it didn't match, PRO wouldn't show up, but it does.

To be longwinded for posterity.

The problem appears to have been in the use of Route::group with the domain key in the array.

When I switched to using dump, the pro.local site was different because it checked the groups first, then died at the HELLO. So, I changed everything to use Route::domain:

Route::domain('pro.local')->group(function () {
  Route::get('/', function () {
    dump('PRO');
  });
});

Route::domain('media.local')->group(function () {
  Route::get('/', function () {
    dump('MEDIA');
  });
});

Route::domain('software.local')->group(function () {
  Route::get('/', function () {
    return view('welcome');
  });
});

And it works as expected. However, the Route::group with domain does not.

Thanks for giving me a different angle!

Cheers, Josh

14 Feb
1 month ago

amidknight started a new conversation Multiple Domains W/ Single Laravel Install

Sort of consolidating a few questions that are old, unresolved, and kind of in keeping with my own problem.

Routes file:

echo url()->current() ."<br>";

echo request()->getHost();

Route::domain('pro.local')->group(function () {
  Route::get('/', function () {
    dd('HELLO');
  });
});

Route::group(['domain' => 'pro.local'], function() {
    dd('PRO');
});

Route::group(['domain' => 'media.local'], function() {
    dd('MEDIA');
});

Route::group(['domain' => 'software.local'], function() {
    dd('SOFTWARE');
});

Route::get('/', function () {
    return view('welcome');
});

Desire & environment: Three domains pro.local, media.local, and software.local all pointing to the same public folder using MAMP PRO 5.2 and Laravel 5.7. This is all I have done to the project so far.

Hypothesis: Using Route::domain or Route::group should result in returning the dd() text or the welcome template.

So far: I know the mono-repo setup I'm using works because I've had the three sites running off the mono-repo for about 3 years and can share the services and what not across projects. With that said, it's annoying to have to SSH into three separate folders to run composer update and npm update; especially when the composer.json and package.json files for each project is essentially the same...I currently use gulp to move and copy files around to keep things in sync.

Problem: No matter the domain, only PRO gets echoed.

I have screenshots

Similar questions

Might have missed a few. I only looked at the first page of results from a search and think I didn't actually paste at least one - all stale - all unresolved.

amidknight left a reply on Multiple Domain Sites With Same Codebase

Attempting something similar. Only for me I'm looking to install Laravel once + point the domain names to the single public directory. Running into issues with Route::domain and Route:group not working quite as described in various tutorials and working attempts from others.

amidknight left a reply on Multiple Domains Same Code Base

Similar question except I'm trying to have a single install + multiple domains pointing to the same public folder on the server. Running into issues with domain routes.

20 Nov
1 year ago

amidknight left a reply on File-based Sessions Not Working If "web" Middleware Assigned In Controller Constructor

https://stackoverflow.com/questions/41542802/laravel-cant-get-session-in-controller-constructor

This does seem to be a workable solution. Though seems a bit odd having to modify Kernal to do something that is "more convenient" according to the docs. Maybe it would be non-session-dependant middleware or something as there is a migration note related to having the Request in the constructor not being part of the framework feature set.

amidknight left a reply on File-based Sessions Not Working If "web" Middleware Assigned In Controller Constructor

Should probably update the documentation then: https://laravel.com/docs/5.5/controllers#controller-middleware

Middleware may be assigned to the controller's routes in your route files:

Route::get('profile', '[email protected]')->middleware('auth');

However, it is more convenient to specify middleware within your controller's constructor. Using the middleware method from your controller's constructor, you may easily assign middleware to the controller's action. You may even restrict the middleware to only certain methods on the controller class:

Just spent a good few minutes trying to clean up my routes file and literally make it more convenient from my perspective. This is pretty much the advice I'm finding.

23 Oct
1 year ago

amidknight started a new conversation Laravel 5.5 Extend Or Override Package Controller

What is the convention in Laravel 5.5 for extending (or overriding) a controller external to the main app and without essentially rewriting the front-end for the package in the app?

I have a package with its own routes and controllers. I'm running into a couple of situations where overriding a method in one of the controllers would be an elegant way to solve a problem; however, the solutions I've come to on my own seem less than ideal. It's not something I seem to need that often because the packages do pretty well on their own.

24 Sep
1 year ago

amidknight left a reply on Assigning Middleware To Route::resource

Old thread.

Came up in search results. Here's what I decided to go with for L5.5:

Route::resource('resource', 'Controller', [
        'only' => [
            'index',
            'show'
        ]
    ])
    ->middleware(['web']);

Route::resource('resource', 'Controller', [
        'except' => [
            'index',
            'show'
        ]
    ])
    ->middleware(['web', 'auth']);

Not fully verified, but route:list shows the proper middlewares being applied.

13 Sep
1 year ago

amidknight left a reply on Custom Model Delete()

Be sure you return the parent call. Seemed to make things work for me.

    public function delete()
    {
        // Do custom things. Like deleting other models 
        // not handled by cascade. For example:
       $this->semiRelatedModel->delete();

       // Model->delete() returns a boolean that seems
       // to be required.
       return parent::delete();
    }
12 Sep
1 year ago
10 Sep
1 year ago

amidknight left a reply on [Symfony\Component\Debug\Exception\FatalThrowableError] Parse Error: Syntax Error, Unexpected '$table' (T_VARIABLE)

For someone else who might have the same issue...and is going insane trying to figure it out...may not be a migrations error. My IDE did an autocomplete I didn't catch in my config/app.php under the providers key.

08 Sep
1 year ago

amidknight left a reply on Laravel 5.1 Access Package Config Values

Here's an old unanswered question I stumbled on search. I don't know if you found your answer.

I think the config reference in Laravel 5+ operates in the same way as the view method. So, the full path would be required. This makes sense in some ways as the main reason, I think, for having a multi-level tree structure is to avoid conflicts. For example:

/config
    /your-vendor/
        googlecal.php
    /my-vendor/
        googlecal.php

If we did:

config('googlecal.client_id')

Which one should Laravel use?

Whereas if we did:

config('your-vendor.googlecal.client_id')

config('my-vendor.googlecal.client_id')

Now we can have two separate configurations. Granted I'm unable to think of a use case where this would be desired or needed; therefore, why bury the cofig in a multi-tier folder structure?

30 Apr
1 year ago

amidknight started a new conversation Laravel 5.4 Fresh Install - Composer Update Results In Could Not Be Resolved Set Of Packages

Only happens after adding PHP Documentor to composer.json.

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.6.4",
        "laravel/framework": "5.4.*",
        "laravel/tinker": "~1.0"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~5.7",
        "phpdocumentor/phpdocumentor": "2.9.*",
        "evert/phpdoc-md" : "~0.2.0"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    }
}

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install symfony/finder 3.3.x-dev
    - Conclusion: don't install symfony/finder 3.2.x-dev
    - Conclusion: remove symfony/finder v3.2.7
    - Conclusion: don't install symfony/finder v3.2.7
    - Conclusion: don't install symfony/finder v3.2.6
    - Conclusion: don't install symfony/finder v3.2.5
    - Conclusion: don't install symfony/finder v3.2.4
    - Conclusion: don't install symfony/finder v3.2.3
    - Conclusion: don't install symfony/finder v3.2.2
    - Conclusion: don't install symfony/finder v3.2.1
    - Conclusion: don't install symfony/finder v3.2.0
    - Conclusion: don't install laravel/framework 5.4.x-dev
    - Conclusion: don't install symfony/finder v3.2.0-RC2
    - Installation request for phpdocumentor/phpdocumentor 2.9.* -> satisfiable by phpdocumentor/phpdocumentor[v2.9.0].
    - Conclusion: don't install symfony/finder v3.2.0-RC1
    - laravel/framework v5.4.21 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.0 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.1 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.10 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.11 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.12 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.13 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.14 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.15 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.16 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.17 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.18 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.19 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.2 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.20 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.21 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.3 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.4 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.5 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.6 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.7 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.8 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - laravel/framework v5.4.9 requires symfony/finder ~3.2 -> satisfiable by symfony/finder[v3.2.7, 3.2.x-dev, 3.3.x-dev, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6].
    - Conclusion: don't install symfony/finder v3.2.0-BETA1
    - Installation request for laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, v5.4.0, v5.4.1, v5.4.10, v5.4.11, v5.4.12, v5.4.13, v5.4.14, v5.4.15, v5.4.16, v5.4.17, v5.4.18, v5.4.19, v5.4.2, v5.4.20, v5.4.21, v5.4.3, v5.4.4, v5.4.5, v5.4.6, v5.4.7, v5.4.8, v5.4.9].
06 Apr
1 year ago

amidknight left a reply on .env Variables In Gulpfile.js

@martinbean

Might be nice to be able to change src paths based on environment without having to .gitignore the gulpfile.js and maintain different ones in all the environments.

// .env
APP_ENV=local
// gulpfile.js
if (env(APP_ENV) == 'local') {
    gulp.task('locals', function() {
        return gulp.src('../[some folder name]/**/*')
            .pipe(gulp.dest('[some local app path]'));
    });

} else if (env(APP_ENV) == 'prod') {
    gulp.task('locals', function() {
        return gulp.src('../../../[some folder name]/**/*')
            .pipe(gulp.dest('[some local app path]'));
    });
}

Server folder structure:

/site1
    /app
    /...
/site2
    /app
    /...
/site3
    /app
    /...
/universals-that-cannot-go-into-package-management
03 Apr
1 year ago

amidknight started a new conversation Script Npm Update Handling The Post-update-cmd Event Returned With An Error

Apologies if this is a duplicate.

  [RuntimeException]                                                        
  Error Output: npm ERR! Linux 3.14.52-vs2.3.6.15-1                         
  npm ERR! argv "/usr/local/dh/nodejs/bin/node" "/usr/bin/npm" "update"     
  npm ERR! node v0.12.0                                                     
  npm ERR! npm  v2.5.1                                                      
  npm ERR! Unsupported URL Type: github:jeroennoten/webpack-stream#patch-1  
  npm ERR!                                                                  
  npm ERR! If you need help, you may report this error at:                  
  npm ERR!     <http://github.com/npm/npm/issues>                           
  npm ERR! Please include the following file with any support request:      
...
  1. Believe this would be related to Elixir.
  2. Not sure if this is an NPM issue that needs to be reported there, or if this is strictly related to Laravel 5.4 Elixir implementation.
  3. Could also be a simple fix I can perform.

I get the error when Laravel runs npm update after composer update as well when running npm update myself.

amidknight left a reply on Php Artisan Commands Not Recognized

Running into the same issue.

  1. PHP 5.6.29 (cli) (built: Dec 9 2016 23:39:41)
  2. I'm not sure I'm following this question.
14 Dec
2 years ago

amidknight started a new conversation Return Only Unique Strings

Not sure if this is he right channel per se, or if this question has already been asked.

I have a schema with a field that accepts a slugged string. This schema also has a relationship id field. Therefore, the slug field does not need to be unique unless the relationship id is also the same.

|slug |id | |:----------|:---:| |hello |1 | |hello |2 | |hello |3 | |sup |1 |

What I would like to do is have a query (or model request) that gets a result set containing only the unique slugs in it - regardless of the id.

Collection {
    [
        'hello', 
        'sup'
    ]
}

Is that possible; or should I be looking for something else.

10 Dec
2 years ago

amidknight left a reply on Zurb Foundation 6 And Laravel 5.3

Copying using Elixir might be worth mentioning as well:

// gulpfile.js
elixir(mix => {
    mix.copy(
        'vendor/zurb/foundation/dist/foundation.js',
        'resources/assets/js'
    );
    mix.sass('app.scss')
       .webpack('app.js');
});

I have not tried copying individual pieces of the Foundation JS suite, but should work the same with the additional solution provided by @Laraveldeep

(Got here through a low level of frustration and a Google search. @Laraveldeep got me close, copying got me the rest of the way. Makes adding Foundation essentially a two step process.)

22 Feb
3 years ago

amidknight left a reply on L5 Maximum Function Nesting Level Of '100' Reached, Aborting!

I am testing form submission.

I created a custom Request used in the controller.

class RegistrationController extends Controller
{
    public function store(RegistrationFormRequest $request) {

    }
}

The following also results int he same PHPUnit error:

class RegistrationController extends Controller
{
    public function store(Request $request) {

    }
}

However, the following does not result in error:

class RegistrationController extends Controller
{
    public function store(RegistrationFormRequest $request) {
        $request = \Request::all();
        ...

    }
}

Just in case someone is actually paying attention to this thread on the team. Because, while it may be an xDebug issue - there may also be an unknown performance hit being caused by this sort of thing.

Cheers.