Laravel を使用して、シンプルなムービー管理システムを構築しています。
ユーザーがDBにムービーを作成するとき、次を使用します
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
ユーザーは、引き続きビューを見ることができます。