Useful Laravel artisan Commands

For making a applications with Laravel, we need to run some laravel commands to create quick elements.

For making modal, controller, mail, migration, notification, event, jobs, middleware, listener automatically in the Laravel specified directory. You can write the following commands

php artisan make:model ModelName
php artisan make:controller ControllerName
php artisan make:mail MailName
php artisan make:migration TableName
php artisan make:notification NotificationName
php artisan make:event EventName
php artisan make:job JobName
php artisan make:middleware MiddlewareName
php artisan make:listener ListenerName

For migrating a specific file in laravel

php artisan migrate --path=/database/migrations/test/

For Undo last Migration for specific file in laravel

php artisan migrate:rollback --path=/database/migrations/test/

For getting sql from laravel query

Model::where($conditions)->toSql()

For clearing configuration cache of your laravel Application

Php artisan config:cache

For Clearing cache of your laravel application

Php artisan cache:clear

For Clearing route cache of your laravel application

Php artisan route:clear

For Clearing view cache of your laravel application

Php artisan view:clear

Creating a application key automatically in your Laravel application. You will find the key .env file. So run the below Laravel commands to create it

Php artisan key:generate

Add login with google oauth2 in your laravel application

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *