Add follower/following methods to profile

pull/9/head
Daniel Supernault 2018-04-17 20:17:42 -06:00
rodzic df45744dae
commit 842af8669b
1 zmienionych plików z 37 dodań i 0 usunięć

37
app/Profile.php 100644
Wyświetl plik

@ -0,0 +1,37 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Profile extends Model
{
public function statuses()
{
return $this->hasMany(Status::class);
}
public function following()
{
return $this->hasManyThrough(
Profile::class,
Follower::class,
'profile_id',
'id',
'id',
'id'
);
}
public function followers()
{
return $this->hasManyThrough(
Profile::class,
Follower::class,
'following_id',
'id',
'id',
'id'
);
}
}