本文整理汇总了PHP中UserList::create方法的典型用法代码示例。如果您正苦于以下问题:PHP UserList::create方法的具体用法?PHP UserList::create怎么用?PHP UserList::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserList
的用法示例。
在下文中一共展示了UserList::create方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: submitNewList
public function submitNewList()
{
if (Sentry::check()) {
$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)'));
}
UserList::create(["user_id" => Sentry::getUser()->id, "title" => $title, "description" => $description, "anime_ids" => $ids]);
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');
}