How to migrate package by command line
_developer_12 last edited by
I have created migration but not understanding that how to migrate any migration for package.
I have tried to run "php artisan migrate" command on root folder but my migration file exist on package folder not a root folder.
Please tell me how can i solve this problem ?
aayush.bhatt172 last edited by
It will work. Just follow these simple steps:
- Create your migration file inside (yourpackage -> src -> Database -> Migrations)
- Now, go to your service provider class (yourpackage -> src -> Providers -> yourpackageServiceprovider.php)
- Inside the boot() function add this code:
$this->loadMigrationsFrom(__DIR __ . '/../Database/Migrations');
ps. -> (In the above code remove the space beteween DIR and __)
- Now run the command (composer dump-autoload).
After that run php artisan migrate and it will migrate your tables.
Feel free to revert back in any kind of confusion or query.