Skip to content

Commit 870e01c

Browse files
committed
Modified "find", "first" methods.
1 parent da79f9c commit 870e01c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Contracts/RepositoryContract.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function pluck($column, $key = null);
5050
* @param int $id
5151
* @param array $columns
5252
*
53-
* @return mixed
53+
* @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static[]|static|null
5454
*/
5555
public function find($id, $columns = ['*']);
5656

@@ -59,7 +59,7 @@ public function find($id, $columns = ['*']);
5959
*
6060
* @param array $columns
6161
*
62-
* @return mixed
62+
* @return \Illuminate\Database\Eloquent\Model|static|null
6363
*/
6464
public function first($columns = ['*']);
6565

src/Eloquent/BaseRepository.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function pluck($column, $key = null)
174174
* @param int $id
175175
* @param array $columns
176176
*
177-
* @return mixed
177+
* @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|static[]|static|null
178178
*/
179179
public function find($id, $columns = ['*'])
180180
{
@@ -183,7 +183,7 @@ public function find($id, $columns = ['*'])
183183

184184
$model = $this->query
185185
->where($this->model->getQualifiedKeyName(), $id)
186-
->firstOrFail($columns);
186+
->first($columns);
187187

188188
$this->resetScope();
189189
$this->resetQuery();
@@ -196,14 +196,14 @@ public function find($id, $columns = ['*'])
196196
*
197197
* @param array $columns
198198
*
199-
* @return mixed
199+
* @return \Illuminate\Database\Eloquent\Model|static|null
200200
*/
201201
public function first($columns = ['*'])
202202
{
203203
$this->applyCriteria();
204204
$this->applyScope();
205205

206-
$model = $this->query->firstOrFail($columns);
206+
$model = $this->query->first($columns);
207207

208208
$this->resetScope();
209209
$this->resetQuery();

0 commit comments

Comments
 (0)