mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
move notification API and UI from shipping portal
This commit is contained in:
@@ -3,11 +3,37 @@
|
||||
namespace App\Models;
|
||||
|
||||
|
||||
use App\Classes\General\Interfaces\Notifiable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
|
||||
class AbstractModel extends Model
|
||||
class AbstractModel extends Model implements Notifiable
|
||||
{
|
||||
use LogsActivity;
|
||||
protected static $logFillable = true;
|
||||
|
||||
/**
|
||||
* @return MorphTo
|
||||
*/
|
||||
public function subject(): MorphTo
|
||||
{
|
||||
return $this->MorphTo('subject');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphTo
|
||||
*/
|
||||
public function target(): MorphTo
|
||||
{
|
||||
return $this->MorphTo('target');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphTo
|
||||
*/
|
||||
public function causer(): MorphTo
|
||||
{
|
||||
return $this->MorphTo('causer');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Notification extends AbstractModel
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'notifications';
|
||||
|
||||
public function package(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(Package::class, 'package_id', 'id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user