浏览代码

Update Status model

Daniel Supernault 6 年之前
父节点
当前提交
6d907414d1
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      app/Status.php

+ 6 - 1
app/Status.php

@@ -103,8 +103,10 @@ class Status extends Model
 
     public function liked() : bool
     {
+        if(Auth::check() == false) {
+            return false;
+        }
         $profile = Auth::user()->profile;
-
         return Like::whereProfileId($profile->id)->whereStatusId($this->id)->count();
     }
 
@@ -130,6 +132,9 @@ class Status extends Model
 
     public function shared() : bool
     {
+        if(Auth::check() == false) {
+            return false;
+        }
         $profile = Auth::user()->profile;
 
         return self::whereProfileId($profile->id)->whereReblogOfId($this->id)->count();