Laravel Tutorials
- What is laravel
- Laravel Installation
- Directory Structure
- htaccess
- Remove public from url
- Artisan Command
- Laravel Configuration
- Routing Configuration
- Namespaces
- Request
- Response
- Controller
- Model
- User Authentication
- Multi User Authentication
- Database Seeding
- Database
- Database Query
- ORM
- One-to-One Relationship
- One-to-Many Relationship
- Many to Many Eloquent Relationship
- Has One Through
- Has Many Through
- Querying Relations
- Middleware
- Laravel Views
- Blade Views
- Print data on view page
- Get Site URL
- Get URL Segment
- Get images from Storage folder
- Clear cache
- Form Class not found
- Flash Message in laravel
- Redirections
- path
- CRUD Projerct
- CRUD in Laravel
- CRUD progran
- Laravel Validation
- Jquery Validation
- Cookie
- Session
- Email Send in laravel
- File uploading
- CSRF Protection
- Helper in Laravel
- Helper Functions
- Guzzle Http Client
- Paypal Payment Gatway Integration
- Cron Job in laravel
- Flash message
- path
- Errors Handling
- Date Format
- Date Format Validation
- Display Image on View Page
- Update User Status using toggle button
- Delete Multiple Records using Checkbox in Laravel?
- Confirmation Before Delete Record
- Delete image from storage
- Remove/Trim Empty & Whitespace From Input Requests
- Block IP Addresses from Accessing Website
- How to Disable New User Registration in Laravel
- Redirect HTTP To HTTPS Using Laravel Middleware
- CKEditor
- slug generate unique
- Prevent Browser's Back Button After Logout
- Datatable dunamically
- encrypt & Decript
- Download File
- Rest API
- Shopping Cart
- Shopping Cart Example
- Dynamic Category-Subcategory Menu
- Ajax Search
- Interview Question
- laravel Tutorilal link
- laravel Tutorilal
Important Links
How to clear cache in Laravel?
Laravel Clear Cache After Logout
destroy session, cookies, cache and prevent browser back button after user logout, so that he will not be able to access auth protected routes or pages after logout.
File name : index.php
public function logout(Request $request) {
header("cache-Control: no-store, no-cache, must-revalidate");
header("cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
Session::flush();
$request->session()->regenerate();
Session::flash('succ_message', 'Logged out Successfully');
return redirect('signin');
}
Clear App Cache Using Artisan Command
To clear laravel application cache use the php artisan cache:clear
php artisan cache:clear
Clear App Cache On Shared Host
Most of the times in shared hosting servers we don’t have SSH access to the server. In that case, to clear laravel application cache we have define a route in our application’s routes/web.php file that invoke the laravel clear application cache command.
Route::get('/clear-cache', function() {
$exitCode = Artisan::call('cache:clear');
return 'Application cache cleared';
});
Clear Route Cache Using Artisan Command
php artisan route:clear
Laravel Clear Route Cache On Shared Host
Route::get('/route-cache', function() {
$exitCode = Artisan::call('route:cache');
return 'Routes cache cleared';
});
Clear Config Cache Using Artisan Command
php artisan config:cache
Laravel Clear Config Cache On Shared Host
Route::get('/config-cache', function() {
$exitCode = Artisan::call('config:cache');
return 'Config cache cleared';
});
Clear View Cache
php artisan view:clear
Clear View Cache On Shared Host
Route::get('/view-clear', function() {
$exitCode = Artisan::call('view:clear');
return 'View cache cleared';
});
composer dump
composer dump-autoload
Clear cache in Laravel from your shared hosting
File name : web.php
// clear application cache
Route::get('/clear-cache', function() {
Artisan::call('cache:clear');
return "Application cache flushed";
});
// clear route cache
Route::get('/clear-route-cache', function() {
Artisan::call('route:clear');
return "Route cache file removed";
});
// clear view compiled files
Route::get('/clear-view-compiled-cache', function() {
Artisan::call('view:clear');
return "View compiled files removed";
});
// clear config files
Route::get('/clear-config-cache', function() {
Artisan::call('config:clear');
return "Configuration cache file removed";
});
How to clear cache
Route::get('/cc', function () {
Artisan::call('cache:clear');
echo '<script>alert("cache clear Success")</script>';
});
Route::get('/ccc', function () {
Artisan::call('config:cache');
echo '<script>alert("config cache Success")</script>';
});
Route::get('/vc', function () {
Artisan::call('view:clear');
echo '<script>alert("view clear Success")</script>';
});
Route::get('/cr', function () {
Artisan::call('route:cache');
echo '<script>alert("route clear Success")</script>';
});
Route::get('/coc', function () {
Artisan::call('config:clear');
echo '<script>alert("config clear Success")</script>';
});
Route::get('/storage123', function () {
Artisan::call('storage:link');
echo '<script>alert("linked")</script>';
});