Notification.php 842 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. use Illuminate\Database\Eloquent\SoftDeletes;
  5. class Notification extends Model
  6. {
  7. use SoftDeletes;
  8. /**
  9. * The attributes that should be mutated to dates.
  10. *
  11. * @var array
  12. */
  13. protected $dates = ['deleted_at'];
  14. protected $fillable = ['*'];
  15. public function actor()
  16. {
  17. return $this->belongsTo(Profile::class, 'actor_id', 'id');
  18. }
  19. public function profile()
  20. {
  21. return $this->belongsTo(Profile::class, 'profile_id', 'id');
  22. }
  23. public function item()
  24. {
  25. return $this->morphTo();
  26. }
  27. public function status()
  28. {
  29. return $this->belongsTo(Status::class, 'item_id', 'id');
  30. }
  31. public function tag()
  32. {
  33. return $this->hasOne(MediaTag::class, 'item_id', 'id');
  34. }
  35. }