Hello friends, long time no see ? hehe, I really apologize for the late post after my last article on multi guard authentication. I was quite busy on multiple projects at work. As we all know Taylor Otwell has released a major version of his masterpiece, Laravel 6 recently. Quite impressive, but even though Laravel has moved to version 6 most of the developers are still confused about some of the artisan commands which are the core of Laravel CLI operations.
This command when fired, will clear your cached routes in web.php and api.php. Next time when laravel is booted it will automatically make a new cached file where routes are defined.
Use this command if you want to explicitly clear the cached routes and make new cached file with updated routes.
Laravel stores all the configuration from App/config directory to a single cached config file at App/bootstrap/cache/config.php.
Whenever you add new config file or change existing config file in App/config directory, laravel will not take latest change by default rather we need to clear the cached config file, php artisan config:clear does the same thing for us.
This command clears the cached config file as mentioned above and recaches the latest configurations into a single file again.
It will remove all the cache associated with the connection to the database.
In laravel blade files are compiled into normal php files and stored into cache at App/storage/framework/views directory
So if you have made any changes into blade files and they are not reflecting in browser, most probably latest changes might have not been cached hence run this command to clear the view caches.
This command serves the same purpose as above but additionally, it auto caches the latest view / blade file changes.
Make use of this command extensively as this command will auto clear and recache all the configuration as well as blade files. Most of the time this command is used on production server after doing all the application configurations like creating database, composer install/update etc.
This is the most common artisan command we use. Why did I actually mentioned this here then ? Here is the reason. We need to make changes to .env file a lot while in development phase because we set variables in key = value pairs and these variables are accessed by configuration files. For example:
App/config/app.php : 'name' => env('APP_NAME', 'Laravel'),
.env file : APP_NAME=AWESOME_APP
‘name’ variable first attempts to take value from the .env file where the key is APP_NAME and if there is no key as APP_NAME then it will take default values as Laravel.
If we change APP_NAME value in .env file something like APP_NAME=MAGNIFICENT_APP, now ‘name’ variable will still be as AWESOME_APP until we stop the laravel application and re-run using
php artisan serve
In this article we discussed about various caching mechanisms laravel provides though artisan commands like php artisan route:clear, php artisan route:cache, php artisan config:clear, php artisan config:cache, php artisan view:clear etc.
Skenix Infotech is a top Laravel Website Development Company with Expert Laravel Developers that provides robust Laravel Development Services at fair costs.
Want to make the most out of the latest Laravel technology? Here is your guide on how to hire the best Laravel developer, and at the right price.
Looking for an attractive & user-friendly web developer? HourlyDeveloper.io, a leading web, and mobile app development company, offers web developers for hire through flexible engagement models. You can **[Hire Web...
With the rapid development in technology, the old ways to do business have changed completely. A lot more advanced and developed ways are ...
SemiDot Infotech is a leading Laravel Development company that offers high quality Laravel development services by expert Laravel developers.