Delete client

This commit is contained in:
Peter Papp
2021-04-28 18:15:33 +02:00
parent b37edd298a
commit 248825f2d1
4 changed files with 52 additions and 2 deletions

View File

@@ -78,8 +78,14 @@ class Client extends Model
{
parent::boot();
static::creating(function ($order) {
$order->id = (string) Str::uuid();
static::creating(function ($client) {
$client->id = (string) Str::uuid();
});
static::deleting(function ($client) {
if ($client->getRawOriginal('avatar')) {
Storage::delete($client->getRawOriginal('avatar'));
}
});
}
}