52 lines
1.0 KiB
PHP
Executable File
52 lines
1.0 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Observers;
|
|
|
|
use App\Models\Barbershop;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class BarbershopObserver
|
|
{
|
|
/**
|
|
* Handle the Barbershop "created" event.
|
|
*/
|
|
public function created(Barbershop $barbershop): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Handle the Barbershop "updated" event.
|
|
*/
|
|
public function updated(Barbershop $barbershop): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Handle the Barbershop "deleting" event.
|
|
*/
|
|
public function deleting(Barbershop $barbershop): void
|
|
{
|
|
if ($barbershop->attachment && $barbershop->attachment->formatted_attachment) {
|
|
Storage::delete("barbershop/{$barbershop->attachment->formatted_attachment}");
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Handle the Barbershop "restored" event.
|
|
*/
|
|
public function restored(Barbershop $barbershop): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Handle the Barbershop "force deleted" event.
|
|
*/
|
|
public function forceDeleted(Barbershop $barbershop): void
|
|
{
|
|
//
|
|
}
|
|
}
|