29 lines
592 B
PHP
29 lines
592 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\NotificationType;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Notifications extends Model
|
|
{
|
|
protected $enumCasts = [
|
|
'type' => NotificationType::class
|
|
];
|
|
|
|
protected $fillable = [
|
|
'type',
|
|
'content'
|
|
];
|
|
|
|
/**
|
|
* Polymorphic relation : Get the parent model
|
|
*/
|
|
public function notifiable() {
|
|
return $this->morphTo();
|
|
}
|
|
|
|
public function notifications_read() {
|
|
return $this->belongsToMany(Customers::class, 'notifications_read', 'notification_id', 'customer_id');
|
|
}
|
|
}
|