I want to create a php file in public directory that runs php artisan migrate:fresh (–seed) command in server. when I upload my project to FTP server I want to open that link (ex: www.project.com/migration.php) and that file should run migration and/or seed files. is it possible
if it is how can I do that?
btw I use Laravel 7.28 version
2
Answers
You can call artisan commands like this in functions or even in routes!
Create a route that calls the Artisan command:
Added the
--force
parameter because in aproduction
environment migrations need to be confirmed.More info on Programmatically Executing Commands