datatable.directory codebase
https://datatable.directory/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
588 B
30 lines
588 B
7 years ago
|
<?php
|
||
|
|
||
|
|
||
|
namespace App\Models\Concerns;
|
||
|
|
||
|
|
||
|
use App\Models\ContentReport;
|
||
|
use App\Models\Notification;
|
||
|
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||
|
|
||
|
trait NotificationContext
|
||
|
{
|
||
|
public function bootNotificationContext()
|
||
|
{
|
||
|
static::deleting(function(NotificationContext $self) {
|
||
|
$self->notificationsAbout()->delete();
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Notifications having this model as a context
|
||
|
*
|
||
|
* @return MorphMany
|
||
|
*/
|
||
|
public function notificationsAbout()
|
||
|
{
|
||
|
return $this->morphMany(Notification::class, 'context');
|
||
|
}
|
||
|
}
|