本文整理汇总了PHP中Video::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Video::orderBy方法的具体用法?PHP Video::orderBy怎么用?PHP Video::orderBy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Video
的用法示例。
在下文中一共展示了Video::orderBy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function index()
{
$banners = Banner::where('active', 'Y')->orderBy('id', 'desc')->get();
$news = News::orderBy('date', 'desc')->take(5)->get();
$videos = Video::orderBy('id', 'desc')->take(5)->get();
return view('home', compact('banners', 'news', 'videos'));
}
示例2: show
/**
* Display the specified resource.
*
* @return Response
*/
public function show()
{
$videos = Video::orderBy('id', 'asc')->get();
return view('video', compact('videos'));
/* $functionalities = Functionality::all();
return view('functionalities', compact('functionalities'));*/
}
示例3: paginate
/**
* Get paginated videos
*
* @param int $page Number of videos per page
* @param int $limit Results per page
* @param boolean $all Show published or all
* @return StdClass Object with $items and $totalItems for pagination
*/
public function paginate($page = 1, $limit = 10, $all = false, $notLazy = false)
{
$result = new \StdClass();
$result->page = $page;
$result->limit = $limit;
$result->totalItems = 0;
$result->items = array();
$query = $this->video->orderBy('created_at', 'DESC')->where('lang', $this->getLang());
$videos = $query->skip($limit * ($page - 1))->take($limit)->get();
$result->totalItems = $this->totalVideos();
$result->items = $videos->all();
if (!$notLazy) {
// set video details
foreach ($result->items as $k => $v) {
$v->setDetailsAttribute($this->getDetails($v['attributes']['type'], $v['attributes']['video_id']));
}
}
return $result;
}
示例4: index
/**
* Display a listing of videos
*
* @return Response
*/
public function index()
{
$search_value = Input::get('s');
if (!empty($search_value)) {
$videos = Video::where('title', 'LIKE', '%' . $search_value . '%')->orderBy('created_at', 'desc')->paginate(9);
} else {
$videos = Video::orderBy('created_at', 'DESC')->paginate(9);
}
$user = Auth::user();
$data = array('videos' => $videos, 'user' => $user, 'admin_user' => Auth::user());
return View::make('admin.videos.index', $data);
}
示例5: function
return Redirect::to("/?s=1");
});
Route::get('contacto', function () {
$cita = Cita::orderBy('created_at', 'desc')->first();
$menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get();
return View::make('contacto', array('cita' => $cita, 'menu' => $menu));
});
Route::get('bio', function () {
$cita = Cita::orderBy('created_at', 'desc')->first();
$menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get();
return View::make('bio', array('cita' => $cita, 'menu' => $menu, 'bio' => DB::table('bio')->orderBy('id', 'desc')->first()));
});
Route::get('/', function () {
$cita = Cita::orderBy('created_at', 'desc')->first();
$galerias = Galeria::with('imagenes')->where('estado', '=', 'Activa')->orderBy('order')->get();
$video = Video::orderBy('id')->first();
$audio = Audio::orderBy('id')->first();
$menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get();
return View::make('index', array('cita' => $cita, 'galerias' => $galerias, 'menu' => $menu, 'audio' => $audio, 'video' => $video));
});
Route::get('/imagen/{name}/{id}', function ($name, $id) {
$cita = Cita::orderBy('created_at', 'desc')->first();
$imagen = Imagen::find($id);
$menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get();
return View::make('imagen', array('cita' => $cita, 'imagen' => $imagen, 'menu' => $menu));
});
Route::get('/video/{name}/{id}', function ($name, $id) {
$cita = Cita::orderBy('created_at', 'desc')->first();
$video = Video::find($id);
$menu = Galeria::where('menu', '=', 'Si')->orderBy('order')->get();
return Redirect::to($video->video);