HolidaysController
目前的样子:
public function _construct(){
$this->middleware('auth');
}
/**
* Display a listing of the holidays.
*
* @return IlluminateHttpResponse
*/
public function index()
{
// get all the holiday requests from the database
$holidayReq = HolidayRequest::all();
// load the view and pass the holiday requests
return view('holidays.index')->with('holidayRequests',$holidayReq);
}
auth
中间件是样板Laravel中间件,我没有改变它。一旦我注销,然后尝试访问/holidays
路由,这会导致上面的index()
方法,我得到以下ErrorException,而不是它应该进入登录页面:
Trying to get property of non-object (View: *followed by long address of the blade file
我刷新了Apache几次,但它似乎仍然不能正常工作。
你定义为构造函数的方法在PHP中不是构造函数。
_construct != __construct