Change some first Eloquent methods to firstOrFail
This commit is contained in:
parent
e3fff4b9a8
commit
64f541d30d
4 changed files with 6 additions and 5 deletions
|
@ -9,6 +9,7 @@ use Monolog\Handler\StreamHandler;
|
|||
use Illuminate\Http\{Request, Response};
|
||||
use App\Exceptions\InvalidTokenException;
|
||||
use Phaza\LaravelPostgis\Geometries\Point;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Ramsey\Uuid\Exception\UnsatisfiedDependencyException;
|
||||
use App\Services\{NoteService, PlaceService, TokenService};
|
||||
|
||||
|
@ -214,8 +215,8 @@ class MicropubController extends Controller
|
|||
//is it a note we are updating?
|
||||
if (mb_substr($urlPath, 1, 5) === 'notes') {
|
||||
try {
|
||||
$note = Note::nb60(basename($urlPath))->first();
|
||||
} catch (\Exception $exception) {
|
||||
$note = Note::nb60(basename($urlPath))->firstOrFail();
|
||||
} catch (ModelNotFoundException $exception) {
|
||||
return response()->json([
|
||||
'error' => 'invalid_request',
|
||||
'error_description' => 'No known note with given ID',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue