Reputation: 229
Using Laravel 4.
I have a filter:
Route::filter('csrf', function()
{
if (Request::forged()) return Response::error('500');
});
and in a controller I'm calling the filter for POST requests:
public function __construct()
{
$this->beforeFilter('csrf', array('on' => 'post'));
}
but I get this error when I'm POSTing:
Call to undefined method Illuminate\Http\Request::forged()
Can anyone give me some insight into what is going wrong please?
Upvotes: 0
Views: 1172
Reputation: 1814
You example is referring to Laravel 3. Here how you should be using it on Laravel 4 https://github.com/laravel/laravel/blob/master/app/filters.php#L74-L80
Upvotes: 1