Changed to topic link
This commit is contained in:
@@ -29,7 +29,7 @@ class TopicsController extends Controller
|
|||||||
public function show(Topic $topic) : JsonResponse
|
public function show(Topic $topic) : JsonResponse
|
||||||
{
|
{
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'topic' => $topic,
|
'topic' => new TopicResource($topic),
|
||||||
'articles' => $topic->articles()->paginate(8)
|
'articles' => $topic->articles()->paginate(8)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,7 @@ class TopicResource extends JsonResource
|
|||||||
return [
|
return [
|
||||||
"name" => $this->name,
|
"name" => $this->name,
|
||||||
"slug" => $this->slug,
|
"slug" => $this->slug,
|
||||||
"url" => url(route('topics.show', $this->slug))
|
"link" => url(route('topics.show', $this->slug))
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user