Notification.php 863 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 $casts = [
  14. 'deleted_at' => 'datetime'
  15. ];
  16. protected $guarded = [];
  17. public function actor()
  18. {
  19. return $this->belongsTo(Profile::class, 'actor_id', 'id');
  20. }
  21. public function profile()
  22. {
  23. return $this->belongsTo(Profile::class, 'profile_id', 'id');
  24. }
  25. public function item()
  26. {
  27. return $this->morphTo();
  28. }
  29. public function status()
  30. {
  31. return $this->belongsTo(Status::class, 'item_id', 'id');
  32. }
  33. public function tag()
  34. {
  35. return $this->hasOne(MediaTag::class, 'item_id', 'id');
  36. }
  37. }