Circle.php 613 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Circle extends Model
  5. {
  6. protected $fillable = [
  7. 'profile_id',
  8. 'name',
  9. 'description',
  10. 'bcc',
  11. 'scope',
  12. 'active'
  13. ];
  14. public function members()
  15. {
  16. return $this->hasManyThrough(
  17. Profile::class,
  18. CircleProfile::class,
  19. 'circle_id',
  20. 'id',
  21. 'id',
  22. 'profile_id'
  23. );
  24. }
  25. public function owner()
  26. {
  27. return $this->belongsTo(Profile::class, 'profile_id');
  28. }
  29. public function url()
  30. {
  31. return url("/i/circle/show/{$this->id}");
  32. }
  33. }