| @@ 184-191 (lines=8) @@ | ||
| 181 | * @throws \Analogue\ORM\Exceptions\EntityNotFoundException |
|
| 182 | * @return mixed|self |
|
| 183 | */ |
|
| 184 | public function findOrFail($id, $columns = ['*']) |
|
| 185 | { |
|
| 186 | if (!is_null($entity = $this->find($id, $columns))) { |
|
| 187 | return $entity; |
|
| 188 | } |
|
| 189 | ||
| 190 | throw (new EntityNotFoundException)->setEntity(get_class($this->entityMap)); |
|
| 191 | } |
|
| 192 | ||
| 193 | ||
| 194 | /** |
|
| @@ 212-219 (lines=8) @@ | ||
| 209 | * @throws EntityNotFoundException |
|
| 210 | * @return \Analogue\ORM\Entity |
|
| 211 | */ |
|
| 212 | public function firstOrFail($columns = ['*']) |
|
| 213 | { |
|
| 214 | if (!is_null($entity = $this->first($columns))) { |
|
| 215 | return $entity; |
|
| 216 | } |
|
| 217 | ||
| 218 | throw (new EntityNotFoundException)->setEntity(get_class($this->entityMap)); |
|
| 219 | } |
|
| 220 | ||
| 221 | /** |
|
| 222 | * Pluck a single column from the database. |
|