use native lara notifs, add phpsandbox package
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,9 @@ namespace App\Models\Concerns;
|
||||
use App\Models\ContentReport;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
|
||||
/**
|
||||
* @property ContentReport $reportsOf
|
||||
*/
|
||||
trait Reportable
|
||||
{
|
||||
public function bootReportable()
|
||||
|
||||
Reference in New Issue
Block a user