LoginSignup
0
1

More than 3 years have passed since last update.

Laravel レコードが存在しているかを確認する 個人メモ

Posted at

目的

  • 当該のレコードが存在することをクエリビルダーで確認する方法をメモ的にまとめる

方法

  1. クエリビルダーにexists()を追加することでレコードの存在を確認できる。レコードが存在していた場合はtrueを、存在していなかった場合はfalseを返す。
  2. 下記に例を記載する。

            return $this->Memo
                ->where('workspace_id', $workspace_id)
                ->exists();
    
0
1
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
0
1