Upgrade to Laravel 9 (#4413)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
This commit is contained in:
parent
95e15d2c8a
commit
cbcf62086f
573 changed files with 4387 additions and 9411 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Pterodactyl\Exceptions\Model;
|
||||
|
||||
use Illuminate\Support\MessageBag;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use Pterodactyl\Exceptions\PterodactylException;
|
||||
|
@ -10,20 +11,10 @@ use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
|||
|
||||
class DataValidationException extends PterodactylException implements HttpExceptionInterface, MessageProvider
|
||||
{
|
||||
/**
|
||||
* The validator instance.
|
||||
*/
|
||||
protected Validator $validator;
|
||||
|
||||
/**
|
||||
* The underlying model instance that triggered this exception.
|
||||
*/
|
||||
protected Model $model;
|
||||
|
||||
/**
|
||||
* DataValidationException constructor.
|
||||
*/
|
||||
public function __construct(Validator $validator, Model $model)
|
||||
public function __construct(protected Validator $validator, protected Model $model)
|
||||
{
|
||||
$message = sprintf(
|
||||
'Could not save %s[%s]: failed to validate data: %s',
|
||||
|
@ -33,35 +24,25 @@ class DataValidationException extends PterodactylException implements HttpExcept
|
|||
);
|
||||
|
||||
parent::__construct($message);
|
||||
|
||||
$this->validator = $validator;
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the validator message bag.
|
||||
*
|
||||
* @return \Illuminate\Support\MessageBag
|
||||
*/
|
||||
public function getMessageBag()
|
||||
public function getMessageBag(): MessageBag
|
||||
{
|
||||
return $this->validator->errors();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the status code for this request.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getStatusCode()
|
||||
public function getStatusCode(): int
|
||||
{
|
||||
return 500;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getHeaders()
|
||||
public function getHeaders(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue