php - There's a way of applying a laravel filter for HTTP method? Like on POST? -
i develop system using laravel
, , system has kind of user how can special operations, called master.
he 1 kind of user how can create/edit things. users "read" permissions can read (show method), though.
there's way of applying filter post methods?
note: use laravel "route::resource"
, grouping them , apllying filter, dispite fact more logical , easy, not easy task do.
you can register filters directly in controller documented here
this post requests:
public function __construct() { $this->beforefilter('permission', array('on' => 'post')); }
or specific controller methods:
$this->beforefilter('permission', array('only' => array('create', 'edit', 'store', 'update', 'delete'));
however in scenario simplest thing might specify methods allowed call:
$this->beforefilter('permission', array('except' => array('index', 'show')));
Comments
Post a Comment