mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-31 22:56:52 +01:00 
			
		
		
		
	 da195fd2fe
			
		
	
	
		da195fd2fe
		
			
		
	
	
	
	
		
			
			* Not found property rule * Make these “better” * Day 1 * Day 2 * Day 3 * Dat 4 * Remove disabled check * Day 4 continued * Run pint * Final changes hopefully * Pint fixes * Fix again * Reset these * Update app/Filament/Admin/Pages/Health.php Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> * Update app/Traits/CheckMigrationsTrait.php Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com> --------- Co-authored-by: MartinOscar <40749467+rmartinoscar@users.noreply.github.com>
		
			
				
	
	
		
			63 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			63 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Exceptions\Model;
 | |
| 
 | |
| use Illuminate\Support\MessageBag;
 | |
| use Illuminate\Database\Eloquent\Model;
 | |
| use Illuminate\Contracts\Validation\Validator;
 | |
| use App\Exceptions\PanelException;
 | |
| use Illuminate\Contracts\Support\MessageProvider;
 | |
| use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
 | |
| 
 | |
| class DataValidationException extends PanelException implements HttpExceptionInterface, MessageProvider
 | |
| {
 | |
|     /**
 | |
|      * DataValidationException constructor.
 | |
|      */
 | |
|     public function __construct(protected Validator $validator, protected Model $model)
 | |
|     {
 | |
|         $message = sprintf(
 | |
|             'Could not save %s[%s]: failed to validate data: %s',
 | |
|             get_class($model),
 | |
|             $model->getKey(),
 | |
|             $validator->errors()->toJson()
 | |
|         );
 | |
| 
 | |
|         parent::__construct($message);
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Return the validator message bag.
 | |
|      */
 | |
|     public function getMessageBag(): MessageBag
 | |
|     {
 | |
|         return $this->validator->errors();
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Return the status code for this request.
 | |
|      */
 | |
|     public function getStatusCode(): int
 | |
|     {
 | |
|         return 500;
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * @return array<string, string>
 | |
|      */
 | |
|     public function getHeaders(): array
 | |
|     {
 | |
|         return [];
 | |
|     }
 | |
| 
 | |
|     public function getValidator(): Validator
 | |
|     {
 | |
|         return $this->validator;
 | |
|     }
 | |
| 
 | |
|     public function getModel(): Model
 | |
|     {
 | |
|         return $this->model;
 | |
|     }
 | |
| }
 |