✨ Appelle la commande de téléchargement d'image lors de l'enregistrement
This commit is contained in:
		
							
								
								
									
										14
									
								
								app/Home.php
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								app/Home.php
									
									
									
									
									
								
							| @@ -3,6 +3,7 @@ | |||||||
| namespace App; | namespace App; | ||||||
|  |  | ||||||
| use Illuminate\Database\Eloquent\Model; | use Illuminate\Database\Eloquent\Model; | ||||||
|  | use Illuminate\Support\Facades\Artisan; | ||||||
| use Illuminate\Support\Str; | use Illuminate\Support\Str; | ||||||
| use Spatie\QueryBuilder\QueryBuilder; | use Spatie\QueryBuilder\QueryBuilder; | ||||||
|  |  | ||||||
| @@ -52,4 +53,17 @@ class Home extends Model | |||||||
|     { |     { | ||||||
|         return $query->where('garden_surface', '>=', $price); |         return $query->where('garden_surface', '>=', $price); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * The "booted" method of the model. | ||||||
|  |      * | ||||||
|  |      * @return void | ||||||
|  |      */ | ||||||
|  |     protected static function booted() | ||||||
|  |     { | ||||||
|  |         // Download images on creation | ||||||
|  |         static::created(static function ($home) { | ||||||
|  |             Artisan::call('app:downloadimage ' . $home->id); | ||||||
|  |         }); | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user