本文整理汇总了PHP中Movie::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Movie::orderBy方法的具体用法?PHP Movie::orderBy怎么用?PHP Movie::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Movie
的用法示例。
在下文中一共展示了Movie::orderBy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMemberHome
public function getMemberHome()
{
date_default_timezone_set(config::$timezone);
$today = date("Y-m-d");
// Holding watched movies id
$watchedMovies = Order::where('member_id', '=', Session::get('member_id'))->select('movie_id')->get()->toArray();
// Building query whare id = ? or id = ? so on
$ids = 'id = ?';
for ($i = 1; $i < count($watchedMovies); $i++) {
$ids .= ' or id = ?';
}
$memberWatchedMovies = Movie::orWhereRaw($ids, $watchedMovies)->get();
return View::make('adminArea/home/member-dashboard')->with('newMovies', Movie::orderBy('id', 'desc')->get()->take(20))->with('watchedMovies', $memberWatchedMovies);
}
示例2: postAction
/**
* This function responses to the
* post request of the /admin/movie/action
* then checked which button is pressed in the
* form of movie.view.blade.php of the
* route /admin/movie
*/
public function postAction()
{
// Holding checked row value from movie table
$id = Input::get('checked');
/**
* Redirected route if Edit button is pressed
*/
if (Input::has('Edit')) {
return Redirect::route('movie-edit-get', $id);
}
/**
* Redirected route if Details button is pressed
*/
if (Input::has('Details')) {
return Redirect::route('movie-details-get', $id);
}
/**
* Redirected route if Print button is pressed
*/
if (Input::has('Print')) {
$parameterr = array();
$parameter['movies'] = Movie::orderBy('id', 'desc')->get();
$pdf = PDF::loadView('reports.movie.getAllMovies', $parameter)->setPaper('a4')->setOrientation(config::$MOVIE_REPORT_ORIENTATION)->setWarnings(false);
return $pdf->stream('movies.pdf');
}
/**
* If Delete button is pressed
* destroy function finds movie by id
* and deletes the movie from movie table
*/
if (Input::has('Delete')) {
foreach ($id as $movieId) {
$movie = Movie::find($movieId);
$movie->delete();
}
return Redirect::route('movie-get', 1);
}
}
示例3: index
/**
* Laravel sends content to the frontend as JSON
*
* @return Response
*/
public function index()
{
return Response::json(Movie::orderBy('id', 'desc')->get());
}
示例4: getMovie
/**
* This function responses to
* the get request of /member/movie
* and show all movie as list
*/
public function getMovie()
{
return View::make('adminArea.movie.view')->with('movies', Movie::orderBy('id', 'desc')->get());
}