| @@ 8-30 (lines=23) @@ | ||
| 5 | /** |
|
| 6 | * Class Notifable. |
|
| 7 | */ |
|
| 8 | trait Notifable |
|
| 9 | { |
|
| 10 | use NotifableBasic; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * Get the notifications Relationship. |
|
| 14 | * |
|
| 15 | * @return \Illuminate\Database\Eloquent\Relations\HasMany|\Illuminate\Database\Eloquent\Relations\MorphMany |
|
| 16 | */ |
|
| 17 | public function notifications() |
|
| 18 | { |
|
| 19 | $model = notifynder_config()->getNotificationModel(); |
|
| 20 | if (notifynder_config()->isPolymorphic()) { |
|
| 21 | return $this->morphMany($model, 'to'); |
|
| 22 | } |
|
| 23 | ||
| 24 | return $this->hasMany($model, 'to_id'); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * Get the notifications Relationship. |
|
| 29 | * |
|
| 30 | * @return \Illuminate\Database\Eloquent\Relations\HasMany|\Illuminate\Database\Eloquent\Relations\MorphMany |
|
| 31 | */ |
|
| 32 | public function getNotificationRelation() |
|
| 33 | { |
|
| @@ 8-30 (lines=23) @@ | ||
| 5 | /** |
|
| 6 | * Class Notifable. |
|
| 7 | */ |
|
| 8 | trait NotifableLaravel53 |
|
| 9 | { |
|
| 10 | use NotifableBasic; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * Get the notifications Relationship. |
|
| 14 | * |
|
| 15 | * @return \Illuminate\Database\Eloquent\Relations\HasMany|\Illuminate\Database\Eloquent\Relations\MorphMany |
|
| 16 | */ |
|
| 17 | public function notifynderNotifications() |
|
| 18 | { |
|
| 19 | $model = notifynder_config()->getNotificationModel(); |
|
| 20 | if (notifynder_config()->isPolymorphic()) { |
|
| 21 | return $this->morphMany($model, 'to'); |
|
| 22 | } |
|
| 23 | ||
| 24 | return $this->hasMany($model, 'to_id'); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * Get the notifications Relationship. |
|
| 29 | * |
|
| 30 | * @return \Illuminate\Database\Eloquent\Relations\HasMany|\Illuminate\Database\Eloquent\Relations\MorphMany |
|
| 31 | */ |
|
| 32 | public function getNotificationRelation() |
|
| 33 | { |
|