Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 5 maintenance mode turn on without artisan

Tags:

laravel

Is there any possibility to turn on and turn off Laravel 5 maintenance without php artisan up and down commands when my website is being hosted ?

What I've done:

Route::get('site/shutdown', function(){     return Artisan::call('down'); });  Route::get('site/live', function(){     return Artisan::call('up'); });  

The first route is working fine. But when I call site/live the site still is shuted down. What can cause this problem ?

like image 286
zlotte Avatar asked Jan 15 '16 22:01

zlotte


People also ask

Can I run Laravel without php artisan serve?

and you can run laravel without artisan. If you rename server. php and copy . htaccess , it may make trigger some error when you try to run auth artisan command.

What artisan command bring the application out of maintenance mode?

Artisan::call('down'); To bring the application remove the file or call the up command, as shown above.

Which command we can use to Laravel site in maintenance mode?

To perform maintenance mode on Laravel, run the down Artisan command.


2 Answers

If your project is already down, you cannot call another function.

What happens after you run php artisan down is that it creates a file named down inside storage/framework. After running php artisan up the file is removed.

You can create the file manually inside storage/framework. It will down your project. When you want to take your project live again, just remove the file.

like image 93
smartrahat Avatar answered Sep 28 '22 03:09

smartrahat


I think the right answer is missing here.. You could add your route to app/http/middleware/CheckForMaintenanceMode.php

protected $except = [         //here ]; 

So It never would be off.

like image 33
Vahid2015 Avatar answered Sep 28 '22 03:09

Vahid2015