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/CMS/Transformers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/ledger.corals.io/Corals/modules/CMS/Transformers/NewsTransformer.php
<?php
/**
 * Created by PhpStorm.
 * User: iMak
 * Date: 11/19/17
 * Time: 8:51 AM
 */

namespace Corals\Modules\CMS\Transformers;

use Corals\Foundation\Transformers\BaseTransformer;
use Corals\Modules\CMS\Models\News;

class NewsTransformer extends BaseTransformer
{
    public function __construct($extras = [])
    {
        $this->resource_url = config('cms.models.news.resource_url');

        parent::__construct($extras);
    }

    /**
     * @param News $news
     * @return array
     * @throws \Throwable
     */
    public function transform(News $news)
    {
        $transformedArray = [
            'id' => $news->id,
            'checkbox' => $this->generateCheckboxElement($news),
            'title' => \Str::limit($news->title, 50),
            'slug' => ($news->internal ? 'cms/' : '') . $news->slug,
            'published' => $news->published ? '<i class="fa fa-check text-success"></i>' : '-',
            'published_at' => $news->published ? format_date($news->published_at) : '-',
            'private' => $news->private ? '<i class="fa fa-check text-success"></i>' : '-',
            'internal' => $news->internal ? '<i class="fa fa-check text-success"></i>' : '-',
            'created_at' => format_date($news->created_at),
            'updated_at' => format_date($news->updated_at),
            'action' => $this->actions($news)
        ];

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

Spamworldpro Mini