1
0
mirror of https://github.com/flarum/core.git synced 2025-10-22 04:06:37 +02:00

Add a serializer and API action to get information about the forum

This commit is contained in:
Toby Zerner
2015-06-15 12:18:20 +09:30
parent 0aed5f44bf
commit c1e3820480
6 changed files with 85 additions and 3 deletions

View File

@@ -0,0 +1,29 @@
<?php namespace Flarum\Api\Actions\Forum;
use Flarum\Core\Models\Forum;
use Flarum\Api\Actions\SerializeResourceAction;
use Flarum\Api\JsonApiRequest;
use Flarum\Api\JsonApiResponse;
class ShowAction extends SerializeResourceAction
{
/**
* The name of the serializer class to output results with.
*
* @var string
*/
public static $serializer = 'Flarum\Api\Serializers\ForumSerializer';
/**
* Get the forum, ready to be serialized and assigned to the JsonApi
* response.
*
* @param \Flarum\Api\JsonApiRequest $request
* @param \Flarum\Api\JsonApiResponse $response
* @return \Flarum\Core\Models\Forum
*/
protected function data(JsonApiRequest $request, JsonApiResponse $response)
{
return app('flarum.forum');
}
}