vankhu vu
vankhu vu

Reputation: 33

Call artisan in laravel with migrate:make

Run artisan commands from routes or controller. If you want run your migrations make:

Artisan::call('migrate:make');

but have not migrate name. How to run command : "migrate:make NameMigrate" and use Artisan::call

Upvotes: 3

Views: 3242

Answers (2)

Kamil Kiełczewski
Kamil Kiełczewski

Reputation: 92367

Laravel 8

Artisan::call('make:migration NameMigrate']);

Upvotes: 0

Limon Monte
Limon Monte

Reputation: 54389

I don't like the idea of creating migration in controller, but you surely can perform it.

Laravel 4:

Artisan::call('migrate:make', ['name' => 'migration_name']);

Laravel 5:

Artisan::call('make:migration', ['name' => 'migration_name']);

Don't forget to grant write permission to migrations folder so your application can write files to that folder.

Laravel 4: chmod 777 database/migrations

Laravel 5: chmod 777 app/database/migrations

Upvotes: 4

Related Questions