Initial pass at Laravel 7 support #673
This commit is contained in:
@@ -93,12 +93,12 @@ abstract class Command extends \Illuminate\Console\Command
|
||||
*/
|
||||
public function runCommand($cmd, $return = false, $verbose = true): string
|
||||
{
|
||||
if (\is_array($cmd)) {
|
||||
$cmd = implode(' ', $cmd);
|
||||
if (!\is_array($cmd)) {
|
||||
$cmd = explode(' ', $cmd);
|
||||
}
|
||||
|
||||
if ($verbose) {
|
||||
$this->info('Running "'.$cmd.'"');
|
||||
$this->info('Running "'.implode(' ', $cmd).'"');
|
||||
}
|
||||
|
||||
$val = '';
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
|
||||
namespace App\Contracts;
|
||||
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* Base class for a resource/response
|
||||
*/
|
||||
class Resource extends \Illuminate\Http\Resources\Json\Resource
|
||||
class Resource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Iterate through the list of $fields and check if they're a "Unit"
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
namespace App\Exceptions\Converters;
|
||||
|
||||
use App\Exceptions\AbstractHttpException;
|
||||
use Exception;
|
||||
use Throwable;
|
||||
|
||||
class GenericExceptionAbstract extends AbstractHttpException
|
||||
{
|
||||
private $exception;
|
||||
|
||||
public function __construct(Exception $exception)
|
||||
public function __construct(Throwable $exception)
|
||||
{
|
||||
$this->exception = $exception;
|
||||
parent::__construct(
|
||||
|
||||
@@ -19,6 +19,7 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException as SymfonyHttpException;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Throwable;
|
||||
use Whoops\Handler\HandlerInterface;
|
||||
|
||||
/**
|
||||
@@ -43,11 +44,11 @@ class Handler extends ExceptionHandler
|
||||
* Render an exception into an HTTP response.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Exception $exception
|
||||
* @param \Throwable $exception
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function render($request, Exception $exception)
|
||||
public function render($request, Throwable $exception)
|
||||
{
|
||||
if ($request->is('api/*')) {
|
||||
return $this->handleApiError($request, $exception);
|
||||
@@ -65,11 +66,11 @@ class Handler extends ExceptionHandler
|
||||
* Handle errors in the API
|
||||
*
|
||||
* @param $request
|
||||
* @param \Exception $exception
|
||||
* @param \Throwable $exception
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
|
||||
*/
|
||||
private function handleApiError($request, Exception $exception)
|
||||
private function handleApiError($request, Throwable $exception)
|
||||
{
|
||||
Log::error('API Error', $exception->getTrace());
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\Resource;
|
||||
use App\Contracts\Resource;
|
||||
|
||||
/**
|
||||
* @mixin \App\Models\SimBrief
|
||||
|
||||
Reference in New Issue
Block a user