From a1cb313d4f8aa40fe79b00602a780c25e3869dd0 Mon Sep 17 00:00:00 2001 From: shibafu Date: Mon, 24 Jun 2019 22:39:01 +0900 Subject: [PATCH] =?UTF-8?q?Card=20API=E3=81=A7=E3=82=BF=E3=82=B0=E6=83=85?= =?UTF-8?q?=E5=A0=B1=E3=82=82=E5=8F=96=E3=82=8C=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Api/CardController.php | 2 ++ app/Metadata.php | 2 +- app/Tag.php | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/CardController.php b/app/Http/Controllers/Api/CardController.php index e5578d2..a336830 100644 --- a/app/Http/Controllers/Api/CardController.php +++ b/app/Http/Controllers/Api/CardController.php @@ -51,6 +51,8 @@ class CardController $metadata->tags()->sync($tagIds); } + $metadata->load('tags'); + $response = response($metadata); if (!config('app.debug')) { $response = $response->setCache(['public' => true, 'max_age' => 86400]); diff --git a/app/Metadata.php b/app/Metadata.php index d516b0b..2abd321 100644 --- a/app/Metadata.php +++ b/app/Metadata.php @@ -11,7 +11,7 @@ class Metadata extends Model protected $keyType = 'string'; protected $fillable = ['url', 'title', 'description', 'image', 'expires_at']; - protected $visible = ['url', 'title', 'description', 'image', 'expires_at']; + protected $visible = ['url', 'title', 'description', 'image', 'expires_at', 'tags']; protected $dates = ['created_at', 'updated_at', 'expires_at']; diff --git a/app/Tag.php b/app/Tag.php index 7d4cb9a..479d972 100644 --- a/app/Tag.php +++ b/app/Tag.php @@ -11,6 +11,9 @@ class Tag extends Model protected $fillable = [ 'name' ]; + protected $visible = [ + 'name' + ]; public function ejaculations() {