![]() 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/job-board.corals.io/Corals/modules/Jobs/Transformers/ |
<?php namespace Corals\Modules\Jobs\Transformers; use Corals\Foundation\Transformers\BaseTransformer; use Corals\Modules\Jobs\Models\Job; class JobTransformer extends BaseTransformer { public function __construct($extras = []) { $this->resource_url = config('jobs.models.job.resource_url'); parent::__construct($extras); } /** * @param Job $job * @return array * @throws \Throwable */ public function transform(Job $job) { $transformedArray = [ 'id' => $job->id, 'title' => HtmlElement('a', ['href' => $job->getShowURL()], $job->title) . ' | ' . HtmlElement('a', ['href' => $job->getPublicShowURL(), 'target' => '_blank'], '<i class="fa fa-external-link"></i> Show Public'), 'description' => generatePopover($job->description), 'short_description' => generatePopover($job->short_description), 'owner_id' => $job->owner->present('name'), 'job_type' => $job->jobType->present('label'), 'experience_level' => $job->experienceLevel->present('label'), 'salary' => $job->salary, 'location' => $job->location->present('name'), 'applications_count' => $job->jobApplications()->count(), 'categories' => formatArrayAsLabels($job->categories->pluck('name'), 'success', '<i class="fa fa-folder-open"></i>'), 'tags' => formatArrayAsLabels($job->tags->pluck('name'), 'primary', '<i class="fa fa-tags"></i>'), 'status' => formatStatusAsLabels($job->status), 'starts_at' => format_date($job->starts_at), 'ends_at' => format_date($job->ends_at), 'created_at' => format_date($job->created_at), 'updated_at' => format_date($job->updated_at), 'action' => $this->actions($job) ]; return parent::transformResponse($transformedArray); } }