For developing smartly you must need to know these useful Laravel commands

For making an 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

To create Laravel Model with migration, controller and requests

php artisan make:model ModelName -a


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

To create mail with email blade run the command

php artisan make:mail OrderShipped --markdown=emails.orders.shipped

Add login with google oauth2 in your laravel application

Useful Tags :