0
我正在使用Laravel构建一个简单的电影管理系统。Laravel Sentry限制创作者的编辑权限
当用户在我的数据库中创建了一个电影,我用下面的
public function store()
{
$input = Input::except('_token');
$id = Helpers::loggedInUser()->id;
$input['creator_id'] = $id;
$this->title->create($input);
return Redirect::back()->withSuccess(trans('main.created successfully'));
}
这成功地通过它的用户ID和存储creator_id场
我想限制用户从编辑他们没有创建的电影。所以在编辑功能我有
public function edit($title)
{
$title = $this->title->byURi(e($title));
$id = Helpers::loggedInUser()->id;
$titleuser=$title['creator_id'];
if ($titleuser = $id)
{
return View::make('Titles.Edit')->withTitle($title)->withType('movies');
}
}
但是,这似乎并没有工作。在我的哨兵用户数据库中拥有movie.edit
权限的任何人都可以看到该视图。
谢谢天才。现在工作! – Stephenmelb