I have created controller in laravel using command php artisan make:controller AuthLoginRegisterClass
Now, I want to delete it using only command line, can you please help me ?
Thank you
I have created controller in laravel using command php artisan make:controller AuthLoginRegisterClass
Now, I want to delete it using only command line, can you please help me ?
Thank you
3
Answers
You can do so by running the following command
Firstly, open the command prompt and navigate to the root directory of your Laravel project-
Now, use the ‘rm’ command followed by the path to the controller like-
(if your file is located in the app/Http/Controllers)
after executing this command the controller file will be permanently deleted from your project.
You can utilize the power of shell script to delete the file using terminal. I created a script to delete the file in controllers folder. It will search for the file inside the
Controllers
folder and delete it once it finds it. Here’s the script:delete.sh
You can give this file appropriate permissions i.e.
executable
withchmod +x delete.sh
and use it with the following command:./delete.sh FooBarController.sh
Hope this helps in resolving the issue.