2
0

More than 1 year has passed since last update.

Laravel よく使う関数の返り値早見表

Last updated at Posted at 2022-10-30

概要

Laravelを用いて開発をしている際に関数の返り値とその型がどのようなものであるかを毎回調べるのがめんどくさいので、よく使う関数については早見表にしました。
ご参考になさってください。

返り値早見表

関数名 返り値
get コレクション(中身はModelのオブジェクト) Illuminate\Database\Eloquent\Collection
all コレクション(中身はModelのオブジェクト) Illuminate\Database\Eloquent\Collection
pluck コレクション Illuminate\Support\Collection
find Modelのオブジェクト 対象のモデルクラス or null
first Modelのオブジェクト 対象のモデルクラス or null
create 新規作成されたレコード(Modelのオブジェクト) 対象のモデルクラス
save true or false bool
insert true or false bool
insertGetId 新規作成されたレコードのid int
update 更新されたレコード数 int
upsert 影響されたレコード数 int
delete 削除されたレコード数 int

参考

Laravel API

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