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/BlockTransformer.php
<?php

namespace Corals\Modules\CMS\Transformers;

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

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

        parent::__construct($extras);
    }

    /**
     * @param Block $block
     * @return array
     * @throws \Throwable
     */
    public function transform(Block $block)
    {
        $transformedArray = [
            'id' => $block->id,
            'name' => \Str::limit($block->name, 50),
            'key' => $block->key,
            'status' => formatStatusAsLabels($block->status),
            'created_at' => format_date($block->created_at),
            'updated_at' => format_date($block->updated_at),
            'short_code' => $this->getShortcode($block),
            'action' => $this->actions($block)
        ];

        return parent::transformResponse($transformedArray);
    }

    protected function getShortcode($block)
    {
        return '<b id="shortcode_' . $block->id . '">@block(' . $block->key . ')</b> 
                <a href="#" onclick="event.preventDefault();" class="copy-button"
                data-clipboard-target="#shortcode_' . $block->id . '"><i class="fa fa-clipboard"></i></a>';
    }
}

Spamworldpro Mini