public function headers($name = null, $default = null)
    {
        if ($name) {
            return $this->request->headers->get($name, $default);
        }

        return $this->request->headers->all();
    }
public function headers($name = null, $default = null)
    {
        if ($name) {
            return $this->request->headers->get($name, $default);
        }

        return $this->request->headers->all();
    }
public function headers ( $ name = null , $ default = null ) { if ( $ name ) { return $ this -> request -> headers -> get ( $ name , $ default ) ; } return $ this -> request -> headers -> all ( ) ; }
Gets all headers or header by name

If name is given but does not exist in headers, default value is returned

@param null|string $name
@param null|mixed $default

@return array|mixed
Gets all headers or header by name