derekmcwhinnie

Experience

3,390

0 Best Reply Awards

  • Member Since 4 Years Ago
  • 187 Lessons Completed
  • 31 Favorites

6th September, 2016

derekmcwhinnie started a new conversation Artisan Output Colours (low Contrast = Unreadable) • 2 years ago

Has anyone had a problem with the colour of artisan error messages coming out as light grey on dull red. This colour combination makes error messages almost unreadable.

18th July, 2016

derekmcwhinnie left a reply on Phpunit Woes • 2 years ago

It's a broken symlink to phpunit when project files are installed with larval installer and not composer. Easy to fix......

delete file "vendor/bin/phpunit" delete folder "vendor\phpunit" run composer update

everything will be reinstalled and all will start working again.

30th June, 2016

derekmcwhinnie left a reply on Laravel Artisan Schedule Run Getting Invalid Foreach • 2 years ago

I too have hosted a Laravel app on a shared host. I too have had the same problems with the scheduler. The solution I have found does not agree with the answers above.

Firstly, "register_argc_argv " set to ON or OFF made absolutely no difference to the scheduler. It still failed with a "'ErrorException - Invalid argument supplied for foreach()".

The solution (for me) appears to be the way the cron job is set up. The Laravel documentation states that the cron job should be set up thus..... * * * * * php /home/path/to/artisan schedule:run 1>> /dev/null 2>&1 but for me this did not work. My solution (after a lot of googling...) was to use this instead * * * * * php-cli -q /home/path/to/artisan schedule:run >> /dev/null 2>&1 very similar but not identical.

The "1" after the "schedule:run" causes the Symphony Console component to raise a "Too many arguments exception". I removed the "1" and the error changed so it was having an effect.

The main issue seems to be the use of "php-cli" instead of plain old "php. After this change was implemented everything just started to work as expected.

2nd April, 2016

derekmcwhinnie left a reply on How To Add ServiceProviders And Facades To Only Development Configuration • 2 years ago

Add this to AppServiceProvider....

public function register ()
    {
        //register the service providers for local environment
   
        if ( $this->app->isLocal() )
        {
            if ( ! empty( $providers = config( 'app.dev_providers' ) ) )
            {
                foreach ( $providers as $provider )
                {
                    $this->app->register( $provider );
                }
            }

            if ( ! empty( $aliases = config( 'app.dev_aliases' ) ) )
            {
                foreach ( $aliases as $alias => $facade )
                {
                    $this->app->alias( $alias, $facade );
                }
            }
        }
}

Add this to config.app

'dev_providers' => [
        /*
         * Application Service Providers for development only...
         */
        Somedev\SomePackage\SomePackageServiceProvider::class,
    ],
  'dev_aliases' => [
        /*
         * Aliases to be loaded in development only...
         */
        'DevAlias'      => SomePackage\Facades\AliasClass::class,
    ],

We can define service providers in config.app as usual but know they will only be registered/loaded when the environment is development/local. So when you do a "composer up --nodev" to clear out dev packages then the code won't fail.

I've looked at alot of solutions to this problem and the above is a mixture of then all. Some great ideas out there and all I've done is brought them together to keep it all Laravesque.

Hope it helps someone.

23rd March, 2016

derekmcwhinnie left a reply on SqLite "no Such Table" Error In Unit Tests With Migrations • 2 years ago

I have (hopefully had) a very similar problem with a table not found error when running phpunit. The test worked fine when using my development database (local.sqlite) but failed when I used the phpunit configuration (phpunit.sqlite). Simply trying to have a separate DB for the unit tests.

After alot of head scratching and stepping through the code it appears that the database to be used for tests must be migrated manually once after creation to initialise it BEFORE the tests are run. The DatabaseMigrations trait appears to expect a base migration to exist already before it can roll it back. It does not appear to like a completely empty sqlite file (as created with "touch abc.sqlite" etc.

I set up a config.database with this entry

'phpunit' => [ 'driver' => 'sqlite', 'database' => storage_path('phpunit.sqlite'), 'prefix' => '', ],

the phpunit.xml file had these entries

then I ran

php artisan migrate --database='phpunit'

After this phpunit stopped complaining and all test started to behave.

20th October, 2014

derekmcwhinnie left a reply on Errors Not Showing In Laravel 5 App • 4 years ago

When "storage/meta/compiled.php" doesn't exist (as in my case) then do " 'php artisan optimize' in your app's directory directly on your Vagrant box." as nwitthaus said above. This worked for me.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.