3
2

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 ORM の返り値

Posted at

以下、取得結果は同じ

Eloquent ORM

(Modelを継承したクラス内で)

self::all();
self::select('*')->get();
self::raw('*')->get();

object(Illuminate\Database\Eloquent\Collection)が返却される。

クエリビルダ

DB::table('users')->get();
DB::table('users')->select('*')->get();
DB::table('users')->select(DB::raw('*'))->get();

object(Illuminate\Support\Collection)が返却される。

クエリビルダ

DB::select('select * from users');

array(n) { [0]=> object(stdClass)~ が返却される。

3
2
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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?