Laravel FrozenNode Administrator在维护模式下运行 [英] Laravel FrozenNode Administrator run in maintenance mode

查看:59
本文介绍了Laravel FrozenNode Administrator在维护模式下运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是:如何让Frozennode管理员在Laravel维护模式下正常运行?

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

这就是我在global.php中得到的

This is what I got in global.php

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

谢谢!

推荐答案

实际上还有另一种方式,更简单.正如您可以在Laravel 文档中阅读的那样,从闭包中返回NULL将使Laravel忽略特定的要求:

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

如果传递给down方法的Closure返回NULL,则该请求的维护模式将被忽略.

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

因此,对于以admin开头的路由,您可以执行以下操作:

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);
});

这篇关于Laravel FrozenNode Administrator在维护模式下运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆