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:
29
src/Api/Actions/Forum/ShowAction.php
Normal file
29
src/Api/Actions/Forum/ShowAction.php
Normal 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');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user