app/Http/Resources/SurveyResource.php
/**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
     */
Transform the resource into an array.
Transform the resource into an array .
public function toArray($request)
    {
        return [
            'id' => $this->id,
            'image_url' => $this->image ? URL::to($this->image) : null,
            'title' => $this->title,
            'slug' => $this->slug,
            'status' => $this->status == 1 ? true : false,
            'description' => $this->description,
            'expired_at' => $this->expired_at,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
            'questions' => []
        ];
    }
public function toArray ( $ request ) { return [ 'id' => $ this -> id , 'image_url' => $ this -> image ? URL :: to ( $ this -> image ) : null , 'title' => $ this -> title , 'slug' => $ this -> slug , 'status' => $ this -> status == 1 ? true : false , 'description' => $ this -> description , 'expired_at' => $ this -> expired_at , 'created_at' => $ this -> created_at , 'updated_at' => $ this -> updated_at , 'questions' => [ ] ] ; }
Transform the resource into an array.
Transform the resource into an array .