PHP code example of spatie / laravel-or-abort
1. Go to this page and download the library: Download spatie/laravel-or-abort library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
spatie / laravel-or-abort example snippets
$eloquentModel->findOrAbort($modelId, 500);
$article = $articleRepository->find($articleId) ?: abort(404);
$article = $articleRepository->findOrAbort($articleId);
$article = $articleRepository->findOrAbort($articleId, 500);