laravel/framework — pull request #2514 by adamwathan (2013-10-18 03:17:50+00:00)
Title: Support for controller instance method filters using @filter syntax, proposal #2432

Makes it very fast and easy to use instance methods on your controller as filters. Helpful in cases where maybe you need to do a permission check (like checking if the logged in user actually owns the post they are trying to delete for example) on several actions, and you don't want to register a global filter since the functionality is localized to that controller. A lot cleaner than using closures.

```php
public function __construct()
{
$this->beforeFilter('@hasPermission');
}

protected function hasPermission($route)
{
$id = $route->getParameter('id');

if (! Auth::user()->ownsPost($id)) {
return Response::make('You are not authorized', 401);
}
}
```