✨ Appelle la commande de téléchargement d'image lors de l'enregistrement
This commit is contained in:
parent
0776b7ef53
commit
1e13d8921b
14
app/Home.php
14
app/Home.php
@ -3,6 +3,7 @@
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Str;
|
||||
use Spatie\QueryBuilder\QueryBuilder;
|
||||
|
||||
@ -52,4 +53,17 @@ class Home extends Model
|
||||
{
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user