2016-05-16 59 views

回答

0

不,不是的刀片。

您将需要在控制器方法中执行此操作。

public function index() 
{ 
    if(! AccessFunction()) { 
    return redirect()->route('somewhere'); 
    } 
} 
+0

啊容易peasy。感谢您的回复:) – mikeywikey

+0

该函数是在一个帮助函数内部没有被类定义的,是否仍然可以抛出'use'语句? – mikeywikey

+0

是的100%,使用App \ Helpers \ SomeUtil; SomeUtil :: accessFunction();或者您可以使用完整的名称空间\ App \ Helpers \ SomeUtil :: accessFunction(); – Laracademy