Illuminate\Routing\Router::post PHP Method

post() public method

Register a new POST route with the router.
public post ( string $uri, Closure | array | string | null $action = null ) : Illuminate\Routing\Route
$uri string
$action Closure | array | string | null
return Illuminate\Routing\Route
    public function post($uri, $action = null)
    {
        return $this->addRoute('POST', $uri, $action);
    }

Usage Example

Example #1
0
 public function setup(Router $router)
 {
     // Need to be loaded first.
     $this->route('cms', function ($router) {
         $router->get('/', 'IndexController@index');
         $router->get('logout', 'Auth\\AuthController@logout');
         $router->get('login', 'Auth\\AuthController@index');
         $router->post('login', 'Auth\\AuthController@authenticate');
     });
     // API route to show that it's there.
     $this->route('api', function ($router) {
         $router->get('/', 'REST\\ModelController@index');
         $router->get('/{model}', 'REST\\ModelController@fetchAll')->middleware(['model']);
         $router->get('/{model}/{id}', 'REST\\ModelController@fetch')->middleware(['model']);
         $router->post('/{model}', 'REST\\ModelController@create')->middleware(['auth', 'model']);
         $router->put('/{model}/{id}', 'REST\\ModelController@update')->middleware(['auth', 'model']);
         $router->delete('/{model}/{id}', 'REST\\ModelController@destroy')->middleware(['auth', 'model']);
     });
     // Media uploading routes and controller.
     $this->route('cms', function ($router) {
         $router->post(Media::getLabel('slug') . '/upload', ['as' => 'mediaUpload', 'uses' => 'MediaController@upload']);
         $router->get(Media::getLabel('slug') . '/list', ['as' => 'mediaList', 'uses' => 'MediaController@select']);
     });
     $this->basicSetup();
 }
All Usage Examples Of Illuminate\Routing\Router::post