Dingo\Api\Http\Response\Factory::created PHP Method

created() public method

Respond with a created response and associate a location if provided.
public created ( null | string $location = null, $content = null ) : Response
$location null | string
return Dingo\Api\Http\Response
    public function created($location = null, $content = null)
    {
        $response = new Response($content);
        $response->setStatusCode(201);
        if (!is_null($location)) {
            $response->header('Location', $location);
        }
        return $response;
    }

Usage Example

Beispiel #1
0
 /**
  * Respond with a created response and associate a location if provided.
  *
  * @param null|string $location
  * @return \Dingo\Api\Http\Response 
  * @static 
  */
 public static function created($location = null)
 {
     return \Dingo\Api\Http\Response\Factory::created($location);
 }