mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Add follower/following methods to profile
This commit is contained in:
parent
df45744dae
commit
842af8669b
1 changed files with 37 additions and 0 deletions
37
app/Profile.php
Normal file
37
app/Profile.php
Normal file
|
@ -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'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue