本文整理匯總了PHP中UserList::canEdit方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserList::canEdit方法的具體用法?PHP UserList::canEdit怎麽用?PHP UserList::canEdit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserList
的用法示例。
在下文中一共展示了UserList::canEdit方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: submitUpdateList
public function submitUpdateList()
{
$list = UserList::findOrFail(Input::get('list_id'));
if (!empty($list) && UserList::canEdit($list->user_id)) {
$title = Input::get('title');
$description = Input::get('description');
$anime_ids = Input::get('anime_ids');
if (!empty($title) && !empty($description)) {
if (!empty($anime_ids)) {
$arr_count = count($anime_ids) - 1;
$total_count = 0;
$count = 0;
$ids = "";
foreach ($anime_ids as $anime_id) {
if (is_numeric($anime_id)) {
if ($arr_count == $total_count) {
$ids .= $anime_id;
} else {
$ids .= $anime_id . ",";
}
$count++;
}
$total_count++;
}
if ($count < 7) {
return View::make('user_lists.home')->nest('update_msg', 'child.alerts', array('msg' => 'Minimum 7 animes in the list! (No maximum limit)'));
}
$list->title = $title;
$list->description = $description;
$list->anime_ids = $ids;
$list->save();
return View::make('user_lists.home')->nest('update_msg', 'child.alerts', array('msg_type' => 'success', 'msg' => 'Anime list has been created!'));
} else {
return View::make('user_lists.home')->nest('update_msg', 'child.alerts', array('msg' => 'No anime selected!'));
}
} else {
return View::make('user_lists.home')->nest('update_msg', 'child.alerts', array('msg' => 'Please, fill in the title/description!'));
}
}
return Redirect::to('/account');
}