41 lines
768 B
PHP
41 lines
768 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Events\ModelCustomerCreated;
|
|
use App\Events\ModelCustomerDeleting;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Str;
|
|
|
|
class Customer extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'email',
|
|
'phone',
|
|
'address',
|
|
'city',
|
|
'state',
|
|
'zip',
|
|
'country',
|
|
'company',
|
|
];
|
|
|
|
public static function boot()
|
|
{
|
|
parent::boot();
|
|
|
|
static::created(function ($model) {
|
|
event(new ModelCustomerCreated($model));
|
|
});
|
|
|
|
static::deleting(function ($model) {
|
|
event(new ModelCustomerDeleting($model));
|
|
});
|
|
|
|
}
|
|
|
|
}
|