aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/JsonApi/Routes/Forum/PostingReactionShow.php
blob: fb658b9e9018720da0261d94699b4eb66719ae90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
namespace JsonApi\Routes\Forum;

use Forum\PostingReaction;
use JsonApi\Errors\RecordNotFoundException;
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use JsonApi\JsonApiController;

class PostingReactionShow extends JsonApiController
{
    protected $allowedIncludePaths = [
        \JsonApi\Schemas\Forum\PostingReaction::REL_POSTING,
        \JsonApi\Schemas\Forum\PostingReaction::REL_USER,
    ];

    public function __invoke(Request $request, Response $response, $args)
    {
        $posting_reaction = PostingReaction::find($args['reaction_id']);
        if (!$posting_reaction) {
            throw new RecordNotFoundException();
        }

        return $this->getContentResponse($posting_reaction);
    }
}