30
25

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Eloquentのソート(並び替え)

Last updated at Posted at 2016-08-04

#ポイント

  • orderBy で並び替え
  • get() の呼び出し忘れずに
  • descは小さくなっていく
  • ascは大きくなっていく
$trip_contents = TripContents::orderBy('recruitment_end_date', 'asc')->get();

絞込操作とつなげたり。

$trips = Trip::where('is_pending', '=', false)
    ->orderBy('created_date', 'asc')
    ->lists('trip_id');

##ちなみにDBファザードの場合は

DB::table('book')->orderBy('published', 'asc')->orderBy('price', 'desc')->toSql();
30
25
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
30
25

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?