app/Http/Resources/FlightOfferCardResource.php
/**
     * Transform the resource into an array.
     *
     * @param Request $request
     * @return array
     */
Transform the resource into an array.
@param Request $request
@return array
Transform the resource into an array . @param Request $request @return array
public function toArray($request): array
    {
        $destination = $this->destinations ? $this->destinations->first() : null;
        return [
            'id' => $this->id,
            'title' => $this->title,
            'slug' => $this->slug,
            'imageUrl' => $this->backgroundImageSrc('medium'),
            'destination' => new DestinationResource($destination),
        ];
    }
public function toArray ( $ request ) : array { $ destination = $ this -> destinations ? $ this -> destinations -> first ( ) : null ; return [ 'id' => $ this -> id , 'title' => $ this -> title , 'slug' => $ this -> slug , 'imageUrl' => $ this -> backgroundImageSrc ( 'medium' ) , 'destination' => new DestinationResource ( $ destination ) , ] ; }
Transform the resource into an array.
Transform the resource into an array .