Question

My question is: How can I leave the Frozennode administrator runs normaly on Laravel Maintenance Mode?

This is what I got in global.php

App::down(function()
{
    return Response::view('maintenance', array(), 503);
});

Thanks!

Was it helpful?

Solution 2

There is actually another way, more straightforward. As you can read in Laravel documentation, returning NULL from closure will make Laravel ignore particular request:

If the Closure passed to the down method returns NULL, maintenance mode will be ignored for that request.

So for routes beginning with admin, you can do something like this:

App::down(function()
{
  // requests beginning with 'admin' will bypass 'down' mode
  if(Request::is('admin*')) {
    return null;
  }

  // all other routes: default 'down' response
  return Response::view('maintenance', array(), 503);
});

OTHER TIPS

I've dug in the core, there's no way you can do it. Laravel checks for a file named down in app/storage/meta folder, if it's there, Laravel won't even call the routes, it'll just show the error page.

This is isDownForMaintenance function from laravel:

public function isDownForMaintenance()
{
    return file_exists($this['path.storage'].'/meta/down');
}

There's no configuration possible.

An alternative way to the laravelish "maintenance mode" is to set a new value in config/app.php, add:

'maintenance' => true,

Then add this to your before filter:

App::before(function($request)
{
    if(
        Config::get('app.maintenance') &&
        Request::segment(1) != 'admin' // This will work for all admin routes
        // Other exception URLs
    )
    return Response::make(View::make('hello'), 503);
});

And then just set :

'maintenance' => true,

To go back to normal mode

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top