File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ public function get($columns = ['*']): mixed;
21
21
22
22
public function first ($ columns = ['* ' ]): mixed ;
23
23
24
+ public function firstWhere (array $ where , $ columns = ['* ' ]): mixed ;
25
+
24
26
public function firstOrNew (array $ attributes , array $ values = []): mixed ;
25
27
26
28
public function firstOrCreate (array $ attributes , array $ values = []): mixed ;
Original file line number Diff line number Diff line change @@ -152,6 +152,20 @@ public function first($columns = ['*']): mixed
152
152
return $ result ;
153
153
}
154
154
155
+ public function firstWhere (array $ where , $ columns = ['* ' ]): mixed
156
+ {
157
+ $ this ->applyCriteria ();
158
+ $ this ->applyScope ();
159
+
160
+ $ this ->applyConditions ($ where );
161
+
162
+ $ result = $ this ->model ->first ($ columns );
163
+
164
+ $ this ->resetModel ();
165
+
166
+ return $ result ;
167
+ }
168
+
155
169
public function firstOrNew (array $ attributes , array $ values = []): mixed
156
170
{
157
171
$ this ->applyCriteria ();
You can’t perform that action at this time.
0 commit comments