Appelle la commande de téléchargement d'image lors de l'enregistrement

This commit is contained in:
Clement 2020-08-27 14:48:42 +02:00
parent 0776b7ef53
commit 1e13d8921b

View File

@ -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);
});
}
}