app/Http/Resources/PostCollection.php
/**
     * Transform the resource collection into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
Transform the resource collection into an array.
@param  \Illuminate\Http\Request  $request
@return array
Transform the resource collection into an array . @param \ Illuminate \ Http \ Request $request @return array
public function toArray($request)
    {
        return [
            'id' => $this->id,
            'title' => $this->title,
            'content' => $this->content,
            'slug'=>$this->slug,
            'user'=>$this->user_id,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
        ];
    }
public function toArray ( $ request ) { return [ 'id' => $ this -> id , 'title' => $ this -> title , 'content' => $ this -> content , 'slug' => $ this -> slug , 'user' => $ this -> user_id , 'created_at' => $ this -> created_at , 'updated_at' => $ this -> updated_at , ] ; }
Transform the resource collection into an array.
Transform the resource collection into an array .
// return parent::toArray($request);