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.

2 thoughts on “ Call Laravel Artisan Seed From Your Code ”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s