mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
notifiable
This commit is contained in:
@@ -3,13 +3,13 @@
|
||||
namespace App\Classes\General\Interfaces;
|
||||
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
|
||||
interface Notifiable
|
||||
{
|
||||
public function subject(): morphMany;
|
||||
public function subject(): MorphTo;
|
||||
|
||||
public function target(): morphMany;
|
||||
public function target(): MorphTo;
|
||||
|
||||
public function causer(): morphMany;
|
||||
public function causer(): MorphTo;
|
||||
}
|
||||
@@ -3,11 +3,39 @@
|
||||
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');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -34,31 +34,6 @@ class Order extends AbstractModel implements Addressable, Packable, Remarkable,
|
||||
return $this->belongsTo(CompanyModule::class, 'company_module_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function subject(): morphMany
|
||||
{
|
||||
return $this->morphMany(Notification::class, 'subject_type');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function target(): morphMany
|
||||
{
|
||||
return $this->morphMany(Notification::class, 'target');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
public function causer(): morphMany
|
||||
{
|
||||
return $this->morphMany(Notification::class, 'causer');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return MorphMany
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user