Call Laravel Artisan Seed From Your Code

There are certain times when using Laravel that you would like to migrate and seed the database. Typically this is done via the Artisan command line tool with:

php artisan migrate --seed

You can also call this in your code with the following:

Artisan::call('migrate', ['--seed' => true]);

Nice and simple but the second parameter always trips me up.

0 Replies to “Call Laravel Artisan Seed From Your Code”

Leave a Reply