本文整理匯總了PHP中Illuminate\Routing\Router::patch方法的典型用法代碼示例。如果您正苦於以下問題:PHP Router::patch方法的具體用法?PHP Router::patch怎麽用?PHP Router::patch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Routing\Router
的用法示例。
在下文中一共展示了Router::patch方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: registerMacros
protected function registerMacros(Router $router)
{
$router->macro('module', function ($module, $sortable = false) use($router) {
$controller = ucfirst($module) . 'Controller';
if ($sortable) {
$router->patch("{$module}/changeOrder", $controller . '@changeOrder');
}
$router->resource($module, $controller);
});
$this->app['paginateroute']->registerMacros();
}
示例2: patch
/**
* Register a new PATCH route with the router.
*
* @param string $uri
* @param \Closure|array|string $action
* @return \Illuminate\Routing\Route
* @static
*/
public static function patch($uri, $action)
{
return \Illuminate\Routing\Router::patch($uri, $action);
}
示例3: patch
/**
* Register a new PATCH route with the router.
*
* @param string $uri
* @param \Closure|array|string $action
*
* @return \Illuminate\Routing\Route|void
*/
public function patch($uri, $action)
{
return $this->router->patch($uri, $action);
}
示例4: registerMacros
/**
* @param \Illuminate\Routing\Router $router
*/
protected function registerMacros(Router $router)
{
$router->macro('redirect', function ($url, $action) use($router) {
$router->get($url, function () use($action) {
return redirect()->action($action);
});
});
$router->macro('module', function ($slug, $className, $sortable = false) use($router) {
if ($sortable) {
$router->patch("{$slug}/changeOrder", "{$className}Controller@changeOrder");
}
$router->resource($slug, "{$className}Controller");
});
$router->macro('articleList', function ($technicalNamePrefix, $action) use($router) {
$articles = app(ArticleRepository::class)->getWithTechnicalNameLike($technicalNamePrefix);
$router->get(app()->getLocale() . '/' . fragment_slug("navigation.{$technicalNamePrefix}"), function () use($articles) {
return redirect(route("{$articles->first()->technical_name}"));
})->name($technicalNamePrefix);
$articles->map(function ($article) use($technicalNamePrefix, $action, $router) {
$router->get(app()->getLocale() . '/' . fragment_slug("navigation.{$technicalNamePrefix}") . '/' . $article->url, $action)->name("{$article->technical_name}");
});
});
}
示例5: addPatchResourceUpdate
/**
* Add the update method for a resourceful route.
*
* @param string $name
* @param string $base
* @param string $controller
* @return void
*/
protected function addPatchResourceUpdate($name, $base, $controller)
{
$uri = $this->getResourceUri($name) . '/{' . $base . '}';
$this->router->patch($uri, $controller . '@update');
}
示例6: patch
/**
* Registers a new PATCH route.
*
* @param string $uri The URI (e.g. / or /users or /users/{param}/friends).
* @param string $controller The path to the controller handling the resource (e.g. UsersController::class or App\Http\Controllers\UsersController).
* @param string $method Name of the method inside the controller that will handle the request.
* @return $this
*/
public function patch($uri, $controller, $method)
{
$this->router->patch($uri, $controller . '@' . $method);
return $this;
}
示例7: map
public function map(Router $router)
{
// Admin Index
$router->get('admin', ['as' => 'admin.index', 'middleware' => ['auth', 'admin', 'csrf'], 'uses' => 'Admin\\BaseController@getIndex']);
$router->group(['prefix' => 'admin/settings', 'middleware' => ['auth', 'admin', 'csrf']], function () use($router) {
$router->get('/', ['as' => 'admin.settings', 'uses' => 'Admin\\BaseController@getSettings']);
$router->post('/', ['uses' => 'Admin\\BaseController@postSettings']);
});
$router->group(['prefix' => 'admin/users', 'middleware' => ['auth', 'admin', 'csrf']], function () use($router) {
// View All Accounts on System
$router->get('/', ['as' => 'admin.users', 'uses' => 'Admin\\UserController@getIndex']);
// View Specific Account
$router->get('/view/{id}', ['as' => 'admin.users.view', 'uses' => 'Admin\\UserController@getView']);
// View Specific Account
$router->post('/view/{id}', ['uses' => 'Admin\\UserController@updateUser']);
// Delete an Account Matching an ID
$router->delete('/view/{id}', ['uses' => 'Admin\\UserController@deleteUser']);
// Show Create Account Page
$router->get('/new', ['as' => 'admin.users.new', 'uses' => 'Admin\\UserController@getNew']);
// Handle Creating New Account
$router->post('/new', ['uses' => 'Admin\\UserController@postNew']);
});
// Server Routes
$router->group(['prefix' => 'admin/servers', 'middleware' => ['auth', 'admin', 'csrf']], function () use($router) {
// View All Servers
$router->get('/', ['as' => 'admin.servers', 'uses' => 'Admin\\ServersController@getIndex']);
// View Create Server Page
$router->get('/new', ['as' => 'admin.servers.new', 'uses' => 'Admin\\ServersController@getNew']);
// Handle POST Request for Creating Server
$router->post('/new', ['uses' => 'Admin\\ServersController@postNewServer']);
// Assorted Page Helpers
$router->post('/new/get-nodes', ['uses' => 'Admin\\ServersController@postNewServerGetNodes']);
$router->post('/new/get-ips', ['uses' => 'Admin\\ServersController@postNewServerGetIps']);
$router->post('/new/service-options', ['uses' => 'Admin\\ServersController@postNewServerServiceOptions']);
$router->post('/new/service-variables', ['uses' => 'Admin\\ServersController@postNewServerServiceVariables']);
// End Assorted Page Helpers
// View Specific Server
$router->get('/view/{id}', ['as' => 'admin.servers.view', 'uses' => 'Admin\\ServersController@getView']);
// Database Stuffs
$router->post('/view/{id}/database', ['as' => 'admin.servers.database', 'uses' => 'Admin\\ServersController@postDatabase']);
// Change Server Details
$router->post('/view/{id}/details', ['uses' => 'Admin\\ServersController@postUpdateServerDetails']);
// Change Server Details
$router->post('/view/{id}/container', ['as' => 'admin.servers.post.container', 'uses' => 'Admin\\ServersController@postUpdateContainerDetails']);
// Change Server Details
$router->post('/view/{id}/startup', ['as' => 'admin.servers.post.startup', 'uses' => 'Admin\\ServersController@postUpdateServerStartup']);
// Rebuild Server
$router->post('/view/{id}/rebuild', ['uses' => 'Admin\\ServersController@postUpdateServerToggleBuild']);
// Change Build Details
$router->post('/view/{id}/build', ['uses' => 'Admin\\ServersController@postUpdateServerUpdateBuild']);
// Suspend Server
$router->post('/view/{id}/suspend', ['uses' => 'Admin\\ServersController@postSuspendServer']);
// Unsuspend Server
$router->post('/view/{id}/unsuspend', ['uses' => 'Admin\\ServersController@postUnsuspendServer']);
// Change Install Status
$router->post('/view/{id}/installed', ['uses' => 'Admin\\ServersController@postToggleInstall']);
// Delete [force delete]
$router->delete('/view/{id}/{force?}', ['uses' => 'Admin\\ServersController@deleteServer']);
});
// Node Routes
$router->group(['prefix' => 'admin/nodes', 'middleware' => ['auth', 'admin', 'csrf']], function () use($router) {
// View All Nodes
$router->get('/', ['as' => 'admin.nodes', 'uses' => 'Admin\\NodesController@getIndex']);
// Add New Node
$router->get('/new', ['as' => 'admin.nodes.new', 'uses' => 'Admin\\NodesController@getNew']);
$router->post('/new', ['uses' => 'Admin\\NodesController@postNew']);
// View Node
$router->get('/view/{id}', ['as' => 'admin.nodes.view', 'uses' => 'Admin\\NodesController@getView']);
$router->post('/view/{id}', ['uses' => 'Admin\\NodesController@postView']);
$router->delete('/view/{id}/allocation/{ip}/{port?}', ['uses' => 'Admin\\NodesController@deleteAllocation']);
$router->get('/view/{id}/allocations.json', ['as' => 'admin.nodes.view.allocations', 'uses' => 'Admin\\NodesController@getAllocationsJson']);
$router->post('/view/{id}/allocations', ['as' => 'admin.nodes.post.allocations', 'uses' => 'Admin\\NodesController@postAllocations']);
// View Deploy
$router->get('/view/{id}/deploy', ['as' => 'admin.nodes.deply', 'uses' => 'Admin\\NodesController@getScript']);
$router->delete('/view/{id}', ['as' => 'admin.nodes.delete', 'uses' => 'Admin\\NodesController@deleteNode']);
});
// Location Routes
$router->group(['prefix' => 'admin/locations', 'middleware' => ['auth', 'admin', 'csrf']], function () use($router) {
$router->get('/', ['as' => 'admin.locations', 'uses' => 'Admin\\LocationsController@getIndex']);
$router->delete('/{id}', ['uses' => 'Admin\\LocationsController@deleteLocation']);
$router->patch('/{id}', ['uses' => 'Admin\\LocationsController@patchLocation']);
$router->post('/', ['uses' => 'Admin\\LocationsController@postLocation']);
});
// API Routes
$router->group(['prefix' => 'admin/api', 'middleware' => ['auth', 'admin', 'csrf']], function () use($router) {
$router->get('/', ['as' => 'admin.api', 'uses' => 'Admin\\APIController@getIndex']);
$router->get('/new', ['as' => 'admin.api.new', 'uses' => 'Admin\\APIController@getNew']);
$router->post('/new', ['uses' => 'Admin\\APIController@postNew']);
$router->delete('/revoke/{key?}', ['as' => 'admin.api.revoke', 'uses' => 'Admin\\APIController@deleteRevokeKey']);
});
// Database Routes
$router->group(['prefix' => 'admin/databases', 'middleware' => ['auth', 'admin', 'csrf']], function () use($router) {
$router->get('/', ['as' => 'admin.databases', 'uses' => 'Admin\\DatabaseController@getIndex']);
$router->get('/new', ['as' => 'admin.databases.new', 'uses' => 'Admin\\DatabaseController@getNew']);
$router->post('/new', ['uses' => 'Admin\\DatabaseController@postNew']);
$router->delete('/delete/{id}', ['as' => 'admin.databases.delete', 'uses' => 'Admin\\DatabaseController@deleteDatabase']);
$router->delete('/delete-server/{id}', ['as' => 'admin.databases.delete-server', 'uses' => 'Admin\\DatabaseController@deleteServer']);
});
// Service Routes
$router->group(['prefix' => 'admin/services', 'middleware' => ['auth', 'admin', 'csrf']], function () use($router) {
//.........這裏部分代碼省略.........
示例8: patch
public function patch($uri, $action, $as = null)
{
return parent::patch($uri, $this->packAction($action, $as));
}