%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/graphicd/www/vebto/common/Comments/Controllers/
Upload File :
Create Path :
Current File : /home/graphicd/www/vebto/common/Comments/Controllers/CommentableController.php

<?php

namespace Common\Comments\Controllers;

use Common\Comments\PaginateModelComments;
use Common\Core\BaseController;

class CommentableController extends BaseController
{
    public function loadComments()
    {
        $modelType = request('commentableType');
        $modelId = request('commentableId');

        if (!$modelType || !$modelId) {
            abort(404);
        }

        $commentable = app(modelTypeToNamespace($modelType))->findOrFail(
            $modelId,
        );

        $pagination = app(PaginateModelComments::class)->execute($commentable);

        return $this->success([
            'pagination' => $pagination,
            'commentCount' => count($pagination['data']),
        ]);
    }
}

Zerion Mini Shell 1.0