diff --git a/.travis.yml b/.travis.yml index ff67b9a39c4c..7bd43141e4d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -72,7 +72,7 @@ before_script: # sh -e /etc/init.d/xvfb start # sleep 3 # ./vendor/laravel/dusk/bin/chromedriver-linux & - - php artisan dusk:chrome-driver 72 + - php artisan dusk:chrome-driver 80 - php artisan serve & script: diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index e863fa5e470e..e139bd9d6723 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -71,7 +71,7 @@ class Handler extends ExceptionHandler public function render($request, Exception $exception) { if ($exception instanceof ModelNotFoundException && $request->expectsJson()) { - return response()->json(['message'=>'Record not found'], 400); + return response()->json(['message'=>$exception->getMessage()], 400); } elseif ($exception instanceof ThrottleRequestsException && $request->expectsJson()) { return response()->json(['message'=>'Too many requests'], 429); } elseif ($exception instanceof FatalThrowableError && $request->expectsJson()) { diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php index 8b07caf9556a..8dbb0eeeb831 100644 --- a/app/Models/BaseModel.php +++ b/app/Models/BaseModel.php @@ -13,6 +13,7 @@ namespace App\Models; use App\DataMapper\ClientSettings; use App\DataMapper\CompanySettings; +use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundException; use App\Filters\QueryFilters; use App\Utils\Traits\MakesHash; use App\Utils\Traits\UserSessionAttributes; @@ -153,6 +154,9 @@ class BaseModel extends Model */ public function resolveRouteBinding($value) { + if(is_numeric($value)) + throw new ModelNotFoundException("Record with value {$value} not found"); + return $this ->withTrashed() ->where('id', $this->decodePrimaryKey($value))->firstOrFail(); diff --git a/app/Services/Credit/ApplyNumber.php b/app/Services/Credit/ApplyNumber.php index 33175c339477..ba4e0fa4d820 100644 --- a/app/Services/Credit/ApplyNumber.php +++ b/app/Services/Credit/ApplyNumber.php @@ -14,7 +14,7 @@ use App\Models\Payment; use App\Services\AbstractService; use App\Services\Customer\CustomerService; use App\Services\Payment\PaymentService; -use App\Traits\GeneratesCounter; +use App\Utils\Traits\GeneratesCounter; class ApplyNumber extends AbstractService {