jeudi 28 avril 2016

How to check if user owns a record with Entrust?

I want to allow users to CRUD only posts they own. I would like not to create a new middleware, but to leverage the existing ones instead. So, Can Entrust's default middlewares be extended to fit this purpose?

class PostsController extends Controller
{
    public function __construct()
    {
        $this->middleware('auth');
        $this->middleware('role:blogger|owner'); // <--
    }

    ...
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire