Maintenance Mode without using Artisan?

You can just call artisan from your application:

Artisan::call('down');

Artisan::call('up');

But since you’ll not have access to get your app up because it’s down. You can create the functionality yourself:

A route for shut it down, user must be authenticated to do this:

Route::group(array('before' => 'auth'), function()
{

    Route::get('shut/the/application/down', function() 
    {
        touch(storage_path().'/meta/my.down');
    });

});

A route to bring it back up:

Route::get('bring/the/application/back/up', function() 
{
    @unlink(storage_path().'/meta/my.down');
});

A filter to check if it’s up:

Route::filter('applicationIsUp', function()
{
    if (file_exists($this['path.storage'].'/meta/my.down'))
    {
        return Redirect::to('site/is/down');
    }
});

A route to show a pretty view when your site is down

Route::get('site/is/down', function() 
{
    return View::make('views.site.down');
});

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)