Update Status model

This commit is contained in:
Daniel Supernault 2019-06-18 00:48:40 -06:00
parent bed5cc74de
commit f98c7caff6
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -150,8 +150,10 @@ class Status extends Model
if(Auth::check() == false) {
return false;
}
$profile = Auth::user()->profile;
return Like::whereProfileId($profile->id)->whereStatusId($this->id)->count();
return Cache::remember('status:'.$this->id.':likedby:userid:'.Auth::id(), now()->addHours(30), function() {
$profile = Auth::user()->profile;
return Like::whereProfileId($profile->id)->whereStatusId($this->id)->count();
});
}
public function likedBy()