6
5

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 1 year has passed since last update.

Laravelのクエリビルダーの戻り値まとめ

Posted at
メソッド 戻り値
create object 作成レコード
insert boolean true,false
update integer 影響を与えたレコード数
delete integer 影響を与えたレコード数
save boolean true,false
hoge.php
/**
 * @return bool
 * 
public function hoge(): bool
{
    $result = User::whereName('太郎')->delete();

    return $result;
}

phpdocが警告してくれて調べたら、delete()の戻り値は真偽値ではありませんでした。

参考:https://readouble.com/laravel/8.x/ja/queries.html

6
5
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
6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?