Viewing File: /home/ubuntu/vedadeals-backend-base/app/Http/Resources/BannerResource.php

<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class BannerResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
     */
    public function toArray($request)
    {
        return [
            'title' => $this->title ? : '',
            'description' => $this->description_formatted ? : '',
            'picture' => $this->picture ? : '',
            'link' => $this->link ? : '',
            'product_unique_id' => $this->product_unique_id ? : '',
            'category_name' => $this->product->category->name ?? ''
        ];
    }
}
Back to Directory File Manager