Bladeren bron

Add new methods to Profile model

Daniel Supernault 7 jaren geleden
bovenliggende
commit
fe70cd1eca
1 gewijzigde bestanden met toevoegingen van 10 en 0 verwijderingen
  1. 10 0
      app/Profile.php

+ 10 - 0
app/Profile.php

@@ -6,6 +6,11 @@ use Illuminate\Database\Eloquent\Model;
 
 class Profile extends Model
 {
+    public function url()
+    {
+        return url('/' . $this->username);
+    }
+    
     public function statuses()
     {
       return $this->hasMany(Status::class);
@@ -34,4 +39,9 @@ class Profile extends Model
         'id'
       );
     }
+
+    public function likes()
+    {
+        return $this->hasMany(Like::class);
+    }
 }