Card APIでタグ情報も取れるようにする
This commit is contained in:
parent
41039a6650
commit
a1cb313d4f
@ -51,6 +51,8 @@ class CardController
|
|||||||
$metadata->tags()->sync($tagIds);
|
$metadata->tags()->sync($tagIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$metadata->load('tags');
|
||||||
|
|
||||||
$response = response($metadata);
|
$response = response($metadata);
|
||||||
if (!config('app.debug')) {
|
if (!config('app.debug')) {
|
||||||
$response = $response->setCache(['public' => true, 'max_age' => 86400]);
|
$response = $response->setCache(['public' => true, 'max_age' => 86400]);
|
||||||
|
@ -11,7 +11,7 @@ class Metadata extends Model
|
|||||||
protected $keyType = 'string';
|
protected $keyType = 'string';
|
||||||
|
|
||||||
protected $fillable = ['url', 'title', 'description', 'image', 'expires_at'];
|
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'];
|
protected $dates = ['created_at', 'updated_at', 'expires_at'];
|
||||||
|
|
||||||
|
@ -11,6 +11,9 @@ class Tag extends Model
|
|||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name'
|
'name'
|
||||||
];
|
];
|
||||||
|
protected $visible = [
|
||||||
|
'name'
|
||||||
|
];
|
||||||
|
|
||||||
public function ejaculations()
|
public function ejaculations()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user