Laravel 4 undefined方法Request :: forged()

时间:2013-06-30 14:05:48

标签: php laravel laravel-4

使用Laravel 4。

我有一个过滤器:

Route::filter('csrf', function()
{
  if (Request::forged()) return Response::error('500');
});

并且在控制器中我正在调用POST请求的过滤器:

public function __construct()
{
  $this->beforeFilter('csrf', array('on' => 'post'));
}

但是我在发帖时遇到了这个错误:

Call to undefined method Illuminate\Http\Request::forged()

有人能给我一些有关出错的信息吗?

1 个答案:

答案 0 :(得分:1)

你的例子是指Laravel 3.这里你应该如何在Laravel 4上使用它https://github.com/laravel/laravel/blob/master/app/filters.php#L74-L80