public function collection(Collection $collection, $transformer, $parameters = [], Closure $after = null)
    {
        if ($collection->isEmpty()) {
            $class = \get_class($collection);
        } else {
            $class = \get_class($collection->first());
        }

        if ($parameters instanceof \Closure) {
            $after = $parameters;
            $parameters = [];
        }

        $binding = $this->transformer->register($class, $transformer, $parameters, $after);

        return new Response($collection, 200, [], $binding);
    }
public function collection(Collection $collection, $transformer, $parameters = [], Closure $after = null)
    {
        if ($collection->isEmpty()) {
            $class = \get_class($collection);
        } else {
            $class = \get_class($collection->first());
        }

        if ($parameters instanceof \Closure) {
            $after = $parameters;
            $parameters = [];
        }

        $binding = $this->transformer->register($class, $transformer, $parameters, $after);

        return new Response($collection, 200, [], $binding);
    }
public function collection ( Collection $ collection , $ transformer , $ parameters = [ ] , Closure $ after = null ) { if ( $ collection -> isEmpty ( ) ) { $ class = \ get_class ( $ collection ) ; } else { $ class = \ get_class ( $ collection -> first ( ) ) ; } if ( $ parameters instanceof \ Closure ) { $ after = $ parameters ; $ parameters = [ ] ; } $ binding = $ this -> transformer -> register ( $ class , $ transformer , $ parameters , $ after ) ; return new Response ( $ collection , 200 , [ ] , $ binding ) ; }
Bind a collection to a transformer and start building a response.

@param \Illuminate\Support\Collection $collection
@param string|callable|object         $transformer
@param array|\Closure                 $parameters
@param \Closure|null                  $after

@return \Dingo\Api\Http\Response
Bind a collection to a transformer and start building a response .