瀏覽代碼

Update Place model

Daniel Supernault 5 年之前
父節點
當前提交
a8b63934e4
共有 1 個文件被更改,包括 6 次插入8 次删除
  1. 6 8
      app/Place.php

+ 6 - 8
app/Place.php

@@ -7,15 +7,8 @@ use Pixelfed\Snowflake\HasSnowflakePrimary;
 
 class Place extends Model
 {
-	use HasSnowflakePrimary;
+	protected $visible = ['id', 'name', 'country', 'slug'];
 
-    /**
-     * Indicates if the IDs are auto-incrementing.
-     *
-     * @var bool
-     */
-    public $incrementing = false;
-    
 	public function url()
 	{
 		return url('/discover/places/' . $this->id . '/' . $this->slug);
@@ -30,4 +23,9 @@ class Place extends Model
 	{
 		return $this->posts()->count();
 	}
+
+	public function statuses()
+	{
+		return $this->hasMany(Status::class, 'id', 'place_id');
+	}
 }