本文整理汇总了PHP中Type::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::orderBy方法的具体用法?PHP Type::orderBy怎么用?PHP Type::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Type
的用法示例。
在下文中一共展示了Type::orderBy方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Reservation $reservation)
{
$this->reservation = $reservation;
View::share('locations', Location::orderBy('name', 'asc')->get());
View::share('types', Type::orderBy('name', 'asc')->get());
View::share('news', Post::where('post_type', 'news')->orderBy('created_at', 'desc')->limit(4)->get());
}
示例2: getIndex
public function getIndex()
{
$key = Input::get('search');
if (isset($key)) {
$data = Type::where('name', 'like', '%' . $key . '%')->orderBy('id', 'desc')->paginate(10);
} else {
$data = Type::orderBy('id', 'desc')->paginate(10);
}
return View::make('home/dashboard', array())->nest('content', 'Type/index', array('data' => $data));
}
示例3: __construct
public function __construct()
{
View::share('page_title', 'Client');
View::share('locations', Location::orderBy('name', 'asc')->get());
View::share('types', Type::orderBy('name', 'asc')->get());
View::share('news', Post::where('post_type', 'news')->orderBy('created_at', 'desc')->limit(4)->get());
if (Sentry::check()) {
View::share('user', Sentry::getUser());
$this->user = Sentry::getUser();
}
}
示例4: dropdown
public static function dropdown($novalue = null)
{
$locations = Type::orderBy('name')->get();
$array = array();
if ($novalue) {
$array = array('' => 'Any');
}
foreach ($locations as $l) {
$key = $l->id;
$array[$key] = ucwords($l->name);
}
return $array;
}
示例5: getTypes
public static function getTypes()
{
$arrData = [];
if (Cache::has('types')) {
$arrData = Cache::get('types');
} else {
$types = Type::orderBy('order_no')->get();
$arrData = [];
if (!$types->isEmpty()) {
$arrData = $types->toArray();
}
Cache::forever('types', $arrData);
}
return $arrData;
}
示例6: getContent
public function getContent($type_id = 'content', $id = 'edit')
{
if ($type_id == 'content' && $id == 'edit') {
$posts = Type::orderBy('created_at', 'desc')->get();
return View::make('admin.content')->with('posts', $posts);
}
$posts = Post::where('type_id', '=', $type_id)->where('parent', '=', '0')->orderBy('created_at', 'desc')->get();
$posts_child = Post::where('type_id', '=', $type_id)->where('parent', '!=', '0')->orderBy('created_at', 'desc')->get();
$view = array('posts' => $posts, 'posts_child' => $posts_child, 'type_id' => $type_id);
$templates = array('page' => 'Текст', 'gallery' => 'Галерея');
//добавляем категорию
if ($type_id == 'type' && $id == 'add') {
$view['templates'] = $templates;
return View::make('admin.post-type', $view);
}
//редактируем категорию
if ($id == 'edit') {
$post = Type::where('id', $type_id)->first();
$view['row'] = $post;
$view['templates'] = $templates;
return View::make('admin.post-type', $view);
} else {
if (is_numeric($id) || $id == 'add') {
$post = Post::find($id);
$galleries = Gallery::where('post_id', $id)->get();
$parent[0] = '';
foreach ($posts as $value) {
if ($value->id != $id) {
$parent[$value['id']] = $value['name'];
}
}
$view['galleries'] = $galleries;
$view['parent'] = $parent;
$view['row'] = $post;
return View::make('admin.posts', $view);
}
}
}