1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- class Instance extends Model
- {
- protected $fillable = ['domain'];
- public function profiles()
- {
- return $this->hasMany(Profile::class, 'domain', 'domain');
- }
- public function statuses()
- {
- return $this->hasManyThrough(
- Status::class,
- Profile::class,
- 'domain',
- 'profile_id',
- 'domain',
- 'id'
- );
- }
- public function reported()
- {
- return $this->hasManyThrough(
- Report::class,
- Profile::class,
- 'domain',
- 'reported_profile_id',
- 'domain',
- 'id'
- );
- }
- public function reports()
- {
- return $this->hasManyThrough(
- Report::class,
- Profile::class,
- 'domain',
- 'profile_id',
- 'domain',
- 'id'
- );
- }
- public function media()
- {
- return $this->hasManyThrough(
- Media::class,
- Profile::class,
- 'domain',
- 'profile_id',
- 'domain',
- 'id'
- );
- }
- public function getUrl()
- {
- return url("/i/admin/instances/show/{$this->id}");
- }
- }
|