mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 08:13:16 +00:00
Update Status model
This commit is contained in:
parent
e98107fd5e
commit
7d7a64382b
1 changed files with 11 additions and 6 deletions
|
@ -150,9 +150,11 @@ class Status extends Model
|
||||||
if(Auth::check() == false) {
|
if(Auth::check() == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Cache::remember('status:'.$this->id.':likedby:userid:'.Auth::id(), now()->addHours(30), function() {
|
$user = Auth::user();
|
||||||
$profile = Auth::user()->profile;
|
$id = $this->id;
|
||||||
return Like::whereProfileId($profile->id)->whereStatusId($this->id)->count();
|
return Cache::remember('status:'.$this->id.':likedby:userid:'.$user->id, now()->addHours(30), function() use($user, $id) {
|
||||||
|
$profile = $user->profile;
|
||||||
|
return Like::whereProfileId($profile->id)->whereStatusId($id)->count();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,9 +195,12 @@ class Status extends Model
|
||||||
if(Auth::check() == false) {
|
if(Auth::check() == false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$profile = Auth::user()->profile;
|
$user = Auth::user();
|
||||||
|
$id = $this->id;
|
||||||
return self::whereProfileId($profile->id)->whereReblogOfId($this->id)->count();
|
return Cache::remember('status:'.$this->id.':sharedby:userid:'.$user->id, now()->addHours(30), function() use($user, $id) {
|
||||||
|
$profile = $user->profile;
|
||||||
|
return self::whereProfileId($profile->id)->whereReblogOfId($id)->count();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sharedBy()
|
public function sharedBy()
|
||||||
|
|
Loading…
Reference in a new issue