Instance.php 958 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Instance extends Model
  5. {
  6. protected $fillable = ['domain'];
  7. public function profiles()
  8. {
  9. return $this->hasMany(Profile::class, 'domain', 'domain');
  10. }
  11. public function statuses()
  12. {
  13. return $this->hasManyThrough(
  14. Status::class,
  15. Profile::class,
  16. 'domain',
  17. 'profile_id',
  18. 'domain',
  19. 'id'
  20. );
  21. }
  22. public function reported()
  23. {
  24. return $this->hasManyThrough(
  25. Report::class,
  26. Profile::class,
  27. 'domain',
  28. 'reported_profile_id',
  29. 'domain',
  30. 'id'
  31. );
  32. }
  33. public function reports()
  34. {
  35. return $this->hasManyThrough(
  36. Report::class,
  37. Profile::class,
  38. 'domain',
  39. 'profile_id',
  40. 'domain',
  41. 'id'
  42. );
  43. }
  44. public function media()
  45. {
  46. return $this->hasManyThrough(
  47. Media::class,
  48. Profile::class,
  49. 'domain',
  50. 'profile_id',
  51. 'domain',
  52. 'id'
  53. );
  54. }
  55. public function getUrl()
  56. {
  57. return url("/i/admin/instances/show/{$this->id}");
  58. }
  59. }