本文整理汇总了PHP中Illuminate\Routing\Router::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::post方法的具体用法?PHP Router::post怎么用?PHP Router::post使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Routing\Router
的用法示例。
在下文中一共展示了Router::post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
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();
}
示例2: map
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
*
* @return void
*/
public function map(Router $router)
{
$router->group(['namespace' => $this->namespace], function (Router $router) {
/*
* Public routes
*/
$router->get('comments', 'PublicController@index')->name('public::index-comments');
$router->post('comments', 'PublicController@store')->name('public::store-comment');
/*
* Admin routes
*/
$router->get('admin/comments', 'AdminController@index')->name('admin::index-comments');
$router->get('admin/comments/create', 'AdminController@create')->name('admin::create-comment');
$router->get('admin/comments/{comment}/edit', 'AdminController@edit')->name('admin::edit-comment');
$router->post('admin/comments', 'AdminController@store')->name('admin::store-comment');
$router->put('admin/comments/{comment}', 'AdminController@update')->name('admin::update-comment');
$router->post('admin/comments/sort', 'AdminController@sort')->name('admin::sort-comments');
/*
* API routes
*/
$router->get('api/comments', 'ApiController@index')->name('api::index-comments');
$router->put('api/comments/{comment}', 'ApiController@update')->name('api::update-comment');
$router->delete('api/comments/{comment}', 'ApiController@destroy')->name('api::destroy-comment');
});
}
示例3: boot
/**
* Define your route model bindings, pattern filters, etc.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function boot(Router $router)
{
//============
//== ASSETS ==
//============
$this->loadViewsFrom(__DIR__ . '/../resources/views', static::PACKAGE_NAME);
$this->publishes([__DIR__ . '/../resources/views' => base_path('resources/views/vendor/' . static::PACKAGE_NAME)]);
$this->loadViewsFrom(__DIR__ . '/../resources/admin_views', static::PACKAGE_NAME . '_admin');
$this->publishesAdmin([__DIR__ . '/../resources/admin_views' => base_path('resources/views/vendor/' . static::PACKAGE_NAME . '_admin')]);
$this->loadTranslationsFrom('/', static::PACKAGE_NAME);
$this->publishes([__DIR__ . '/../assets/' => public_path('vendor/translation')], 'public');
$this->publishes([__DIR__ . '/../database/migrations/' => database_path('/migrations')], 'migrations');
$this->publishes([__DIR__ . '/../config/' . static::PACKAGE_NAME . '.php' => config_path('neonbug/' . static::PACKAGE_NAME . '.php')]);
//============
//== ROUTES ==
//============
$language = App::make('Language');
$locale = $language == null ? Config::get('app.default_locale') : $language->locale;
$admin_language = App::make('AdminLanguage');
$admin_locale = $admin_language == null ? Config::get('app.admin_default_locale') : $admin_language->locale;
$resource_repo = App::make('ResourceRepository');
//admin
$router->group(['prefix' => $admin_locale . '/admin/' . static::PREFIX, 'middleware' => ['auth.admin', 'admin.menu'], 'role' => static::ROLE, 'menu.icon' => 'world', 'weight' => 6], function ($router) {
$router->get('list', ['as' => static::PREFIX . '::admin::list', 'uses' => static::ADMIN_CONTROLLER . '@adminList']);
$router->get('edit/{id}', ['as' => static::PREFIX . '::admin::edit', 'uses' => static::ADMIN_CONTROLLER . '@adminEdit']);
$router->post('edit/{id}', ['as' => static::PREFIX . '::admin::edit-save', 'uses' => static::ADMIN_CONTROLLER . '@adminEditPost']);
});
$router->group(['prefix' => $admin_locale . '/admin/' . static::PREFIX, 'middleware' => ['auth.admin'], 'role' => static::ROLE], function ($router) {
$router->post('delete', ['as' => static::PREFIX . '::admin::delete', 'uses' => static::ADMIN_CONTROLLER . '@adminDeletePost']);
});
parent::boot($router);
}
示例4: map
public function map(Router $router)
{
// Index of Panel
$router->get('/', ['as' => 'index', 'middleware' => 'auth', 'uses' => 'Base\\IndexController@getIndex']);
// Handle Index. Redirect /index to /
$router->get('/index', function () {
return redirect()->route('index');
});
// Password Generation
$router->get('/password-gen/{length}', ['as' => 'password-gen', 'middleware' => 'auth', 'uses' => 'Base\\IndexController@getPassword']);
// Account Routes
$router->group(['profix' => 'account', 'middleware' => ['auth', 'csrf']], function () use($router) {
$router->get('account', ['as' => 'account', 'uses' => 'Base\\IndexController@getAccount']);
$router->post('/account/password', ['uses' => 'Base\\IndexController@postAccountPassword']);
$router->post('/account/email', ['uses' => 'Base\\IndexController@postAccountEmail']);
});
// TOTP Routes
$router->group(['prefix' => 'account/security', 'middleware' => ['auth', 'csrf']], function () use($router) {
$router->get('/', ['as' => 'account.security', 'uses' => 'Base\\IndexController@getAccountSecurity']);
$router->get('/revoke/{id}', ['as' => 'account.security.revoke', 'uses' => 'Base\\IndexController@getRevokeSession']);
$router->put('/', ['uses' => 'Base\\IndexController@putAccountTotp']);
$router->post('/', ['uses' => 'Base\\IndexController@postAccountTotp']);
$router->delete('/', ['uses' => 'Base\\IndexController@deleteAccountTotp']);
});
}
示例5: map
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
*
* @return void
*/
public function map(Router $router)
{
$router->group(['namespace' => $this->namespace], function (Router $router) {
/*
* Admin routes
*/
$router->get('admin/attribute-groups', 'AttributeGroupsAdminController@index')->name('admin::index-attribute_groups');
$router->get('admin/attribute-groups/create', 'AttributeGroupsAdminController@create')->name('admin::create-attribute_group');
$router->get('admin/attribute-groups/{group}/edit', 'AttributeGroupsAdminController@edit')->name('admin::edit-attribute_group');
$router->post('admin/attribute-groups', 'AttributeGroupsAdminController@store')->name('admin::store-attribute_group');
$router->put('admin/attribute-groups/{group}', 'AttributeGroupsAdminController@update')->name('admin::update-attribute_group');
$router->get('admin/attribute-groups/{group}/attributes', 'AdminController@index')->name('admin::index-attributes');
$router->get('admin/attribute-groups/{group}/attributes/create', 'AdminController@create')->name('admin::create-attribute');
$router->get('admin/attribute-groups/{group}/attributes/{attribute}/edit', 'AdminController@edit')->name('admin::edit-attribute');
$router->post('admin/attribute-groups/{group}/attributes', 'AdminController@store')->name('admin::store-attribute');
$router->put('admin/attribute-groups/{group}/attributes/{attribute}', 'AdminController@update')->name('admin::update-attribute');
$router->post('admin/attributes/sort', 'AdminController@sort')->name('admin::sort-menulinks');
/*
* API routes
*/
$router->get('api/attributes', 'ApiController@index')->name('api::index-attributes');
$router->put('api/attributes/{attribute}', 'ApiController@update')->name('api::update-attribute');
$router->delete('api/attributes/{attribute}', 'ApiController@destroy')->name('api::destroy-attribute');
$router->get('api/attribute-groups', 'AttributeGroupsApiController@index')->name('api::index-attribute_groups');
$router->put('api/attribute-groups/{attribute}', 'AttributeGroupsApiController@update')->name('api::update-attribute_group');
$router->delete('api/attribute-groups/{attribute}', 'AttributeGroupsApiController@destroy')->name('api::destroy-attribute_group');
});
}
示例6: map
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
*
* @return void
*/
public function map(Router $router)
{
$router->group(['namespace' => $this->namespace], function (Router $router) {
/*
* Front office routes
*/
if ($page = TypiCMS::getPageLinkedToModule('contacts')) {
$options = $page->private ? ['middleware' => 'auth'] : [];
foreach (config('translatable.locales') as $lang) {
if ($page->translate($lang)->status && ($uri = $page->uri($lang))) {
$router->get($uri, $options + ['as' => $lang . '.contacts', 'uses' => 'PublicController@form']);
$router->get($uri . '/sent', $options + ['as' => $lang . '.contacts.sent', 'uses' => 'PublicController@sent']);
$router->post($uri, $options + ['as' => $lang . '.contacts.store', 'uses' => 'PublicController@store']);
}
}
}
/*
* Admin routes
*/
$router->get('admin/contacts', 'AdminController@index')->name('admin::index-contacts');
$router->get('admin/contacts/create', 'AdminController@create')->name('admin::create-contact');
$router->get('admin/contacts/{contact}/edit', 'AdminController@edit')->name('admin::edit-contact');
$router->post('admin/contacts', 'AdminController@store')->name('admin::store-contact');
$router->put('admin/contacts/{contact}', 'AdminController@update')->name('admin::update-contact');
/*
* API routes
*/
$router->get('api/contacts', 'ApiController@index')->name('api::index-contacts');
$router->put('api/contacts/{contact}', 'ApiController@update')->name('api::update-contact');
$router->delete('api/contacts/{contact}', 'ApiController@destroy')->name('api::destroy-contact');
});
}
示例7: defineRoutes
private function defineRoutes()
{
$this->router->group(['prefix' => '/dashboard/setting', 'namespace' => 'Settings'], function () {
$this->router->get("/", ['as' => 'setting.index', 'uses' => 'SettingsController@index']);
$this->router->post("/", ['as' => 'setting.post', 'uses' => 'SettingsController@postSetting']);
});
}
示例8: defineRoutes
private function defineRoutes()
{
$this->router->group(['namespace' => "FileManager"], function () {
$this->router->get('dashboard/filemanager', ['as' => 'filemanager.index', 'uses' => 'FileController@getFileManager']);
});
$this->router->group(['prefix' => "dashboard/file", 'namespace' => "FileManager"], function () {
$this->router->model("file_id", File::class);
$this->router->get('/', ['as' => 'file.all', 'uses' => 'FileController@getIndex']);
$this->router->get('/get', ['as' => 'file.getFile', 'uses' => 'FileController@getFile']);
$this->router->get('/add', ['as' => 'file.index', 'uses' => 'FileController@getFileAdd']);
$this->router->get('/edit/{file_id}', ['as' => 'file.edit', 'uses' => 'FileController@getEdit']);
$this->router->get('/manage', ['as' => 'file.manage', 'uses' => 'FileController@getManage']);
$this->router->post('/edit/{file_id}', 'FileController@fileEdit');
$this->router->post('/add', ['as' => 'file.add', 'uses' => 'FileController@postFileAdd']);
$this->router->post('/delete', ['as' => 'file.delete', 'uses' => 'FileController@postDelete']);
$this->router->get('/rename/{file_id}', ['as' => 'file.rename', 'uses' => 'FileController@getFileRename']);
$this->router->post('/rename', ['as' => 'file.rename', 'uses' => 'FileController@postFileRename']);
$this->router->get('/crop/{file_id}', ['as' => 'file.crop', 'uses' => 'FileController@getFileCrop']);
$this->router->post('/crop/{file_id}', ['as' => 'file.crop', 'uses' => 'FileController@postFileCrop']);
$this->router->post('/multiPost', ['as' => 'file.multipleFiles', 'uses' => 'FileController@postMultipleFiles']);
$this->router->get('/list', ['as' => 'file.list', 'uses' => 'FileController@getList']);
});
$this->router->group(['prefix' => "dashboard/folder", 'namespace' => "FileManager"], function () {
$this->router->model("folder_id", Folder::class);
$this->router->get('/index', ['as' => 'folder.all', 'uses' => 'FolderController@getIndex']);
$this->router->get('/add', ['as' => 'folder.add', 'uses' => 'FolderController@getFolderAdd']);
$this->router->get('/edit/{folder_id}', ['as' => 'folder.edit', 'uses' => 'FolderController@getFolderEdit']);
$this->router->get('/manage', ['as' => 'folder.manage', 'uses' => 'FolderController@getFolderManage']);
$this->router->post('/delete', ['as' => 'folder.delete', 'uses' => 'FolderController@postDelete']);
$this->router->post('/add', ['as' => 'folder.add', 'uses' => 'FolderController@postFolderAdd']);
$this->router->post('/edit', ['as' => 'folder.rename', 'uses' => 'FolderController@postFolderRename']);
$this->router->get('/list', ['as' => 'folder.list', 'uses' => 'FolderController@getList']);
});
}
示例9: map
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Router $router)
{
$router->when('admin/contacts*', 'AdminRole');
$router->bind('contact', function ($value) {
return Contact::where('id', $value)->first();
});
/**
* API routes
*/
$router->group(['namespace' => $this->namespace, 'prefix' => 'api'], function ($router) {
$router->post('contacts/batchUpdate', 'ApiContactsController@batchUpdate');
$router->post('contacts/batchDelete', 'ApiContactsController@batchDelete');
$router->post('contacts/setOrder', 'ApiContactsController@setOrder');
$router->resource('contacts', 'ApiContactsController');
});
/**
* Admin routes
*/
$router->group(['namespace' => $this->namespace, 'prefix' => 'admin', 'middleware' => ['auth']], function ($router) {
//List Contact
$router->get('contacts', ['as' => 'contacts', 'uses' => 'AdminContactsController@getIndex', 'permission' => 'contacts_manage']);
//Create Contact
$router->get('contacts/create', ['as' => 'create_contacts', 'uses' => 'AdminContactsController@getCreate', 'permission' => 'contacts_manage']);
$router->post('contacts', ['as' => 'create_contacts', 'uses' => 'AdminContactsController@postCreate', 'permission' => 'contacts_manage']);
//Edit Contact
$router->get('contacts/{id}/edit', ['as' => 'edit', 'uses' => 'AdminContactsController@getEdit', 'permission' => 'contacts_manage']);
$router->post('contacts/{id}', ['uses' => 'AdminContactsController@postEdit', 'permission' => 'contacts_manage']);
$router->get('contacts/export', ['uses' => 'AdminContactsController@export', 'permission' => 'contacts_manage']);
$router->resource('admin/contacts', 'AdminContactsController');
});
}
示例10: map
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
*
* @return void
*/
public function map(Router $router)
{
$router->group(['namespace' => $this->namespace], function (Router $router) {
/*
* Front office routes
*/
if ($page = TypiCMS::getPageLinkedToModule('projects')) {
$options = $page->private ? ['middleware' => 'auth'] : [];
foreach (config('translatable.locales') as $lang) {
if ($uri = $page->uri($lang)) {
$router->get($uri, $options + ['as' => $lang . '.projects', 'uses' => 'PublicController@categories']);
$router->get($uri . '/{categories}', $options + ['as' => $lang . '.projects.categories', 'uses' => 'PublicController@index']);
$router->get($uri . '/{categories}/{slug}', $options + ['as' => $lang . '.projects.categories.slug', 'uses' => 'PublicController@show']);
}
}
}
/*
* Admin routes
*/
$router->get('admin/projects', ['as' => 'admin.projects.index', 'uses' => 'AdminController@index']);
$router->get('admin/projects/create', ['as' => 'admin.projects.create', 'uses' => 'AdminController@create']);
$router->get('admin/projects/{project}/edit', ['as' => 'admin.projects.edit', 'uses' => 'AdminController@edit']);
$router->post('admin/projects', ['as' => 'admin.projects.store', 'uses' => 'AdminController@store']);
$router->put('admin/projects/{project}', ['as' => 'admin.projects.update', 'uses' => 'AdminController@update']);
$router->post('admin/projects/sort', ['as' => 'admin.projects.sort', 'uses' => 'AdminController@projects']);
/*
* API routes
*/
$router->get('api/projects', ['as' => 'api.projects.index', 'uses' => 'ApiController@index']);
$router->put('api/projects/{project}', ['as' => 'api.projects.update', 'uses' => 'ApiController@update']);
$router->delete('api/projects/{project}', ['as' => 'api.projects.destroy', 'uses' => 'ApiController@destroy']);
});
}
示例11: map
/**
* @param Router $router
*/
public function map(Router $router)
{
$router->group(['namespace' => $this->namespace, 'prefix' => 'backend', 'middleware' => ['web', 'theme:backend', 'lang', 'configure:backend']], function (Router $router) {
$router->get('/', function () {
return redirect(url('backend/c/dashboard'));
});
$router->group(['middleware' => 'guest'], function (Router $router) {
$router->get('login', 'Auth\\AuthController@getLogin');
$router->post('login', 'Auth\\AuthController@postLogin');
$router->get('forgot-password', 'Auth\\PasswordController@getEmail');
$router->post('forgot-password', 'Auth\\PasswordController@postEmail');
$router->get('reset-password/{code}', 'Auth\\PasswordController@getReset');
$router->post('reset-password', 'Auth\\PasswordController@postReset');
});
$router->group(['middleware' => 'auth:admin'], function (Router $router) {
$router->get('logout', function () {
\Auth::logout();
\Session::flush();
return redirect('/backend/login');
});
$router->any('c/{controller}', function (Request $request, $controller) {
return app()->call($this->namespace . '\\' . ucfirst($controller) . 'Controller@' . ucfirst(strtolower($request->method())) . 'Index');
});
$router->any('c/{controller}/a/{action}', function (Request $request, $controller, $action) {
return app()->call($this->namespace . '\\' . ucfirst($controller) . 'Controller@' . ucfirst(strtolower($request->method())) . ucfirst(strtolower($action)));
});
});
});
}
示例12: map
public function map(Router $router)
{
$router->group(['prefix' => 'dashboard', 'as' => 'dashboard.', 'middleware' => 'auth', 'namespace' => 'Dashboard'], function ($router) {
# 后台首页
$router->get('/', ['as' => 'console', 'uses' => 'AdminController@console']);
#--------------------
# 控制面板
#--------------------
# 个人资料
$router->get('me', ['as' => 'me', 'uses' => 'AdminMeController@me']);
$router->post('me', 'AdminMeController@meProfile');
# 头像上传
$router->post('avatar', ['as' => 'avatar', 'uses' => 'AdminMeController@avatarUpload']);
#--------------------
# 内容管理
#--------------------
# 期数
$router->delete('issue/delete', ['as' => 'issue.delete', 'uses' => 'AdminIssueController@batchDelete']);
$router->resource('issue', 'AdminIssueController');
# 文章
$router->delete('article/delete', ['as' => 'article.delete', 'uses' => 'AdminArticleController@batchDelete']);
$router->resource('article', 'AdminArticleController');
# 投稿
$router->delete('submission/delete', ['as' => 'submission.delete', 'uses' => 'AdminSubmissionController@batchDelete']);
$router->get('submission', ['as' => 'submission.index', 'uses' => 'AdminSubmissionController@index']);
$router->get('submission/{id}/edit', ['as' => 'submission.edit', 'uses' => 'AdminSubmissionController@edit']);
$router->put('submission/{id}', ['as' => 'submission.update', 'uses' => 'AdminSubmissionController@update']);
$router->delete('submission/{id}', ['as' => 'submission.destroy', 'uses' => 'AdminSubmissionController@destroy']);
# 分类
$router->resource('category', 'AdminCategoryController');
#--------------------
# 用户管理
#--------------------
$router->group(['middleware' => 'deny403:manage_users'], function ($router) {
# 后台员
$router->resource('user', 'AdminUserController');
# 订阅用户
$router->delete('subscribe/delete', ['as' => 'subscribe.delete', 'uses' => 'AdminSubscribeController@batchDelete']);
$router->resource('subscribe', 'AdminSubscribeController');
# 角色
$router->resource('role', 'AdminRoleController');
# 权限
$router->resource('permission', 'AdminPermissionController');
});
#--------------------
# 系统管理
#--------------------
$router->group(['middleware' => 'deny403:manage_system'], function ($router) {
# 系统配置
$router->get('system_settings', ['as' => 'system.setting', 'uses' => 'AdminSystemSettingController@index']);
$router->post('system_settings', 'AdminSystemSettingController@update');
# 系统日志
$router->get('system_logs', ['as' => 'system.log.index', 'uses' => 'AdminSystemLogController@index']);
$router->get('system_logs/{id}', ['as' => 'system.log.show', 'uses' => 'AdminSystemLogController@show']);
# 导出 excel
$router->get('export/excel', ['as' => 'export.excel', 'uses' => 'AdminSystemLogController@excelExport']);
});
});
}
示例13: map
public function map(Router $router)
{
$router->group(['prefix' => 'remote'], function () use($router) {
// Handles Remote Download Authentication Requests
$router->post('download', ['as' => 'remote.download', 'uses' => 'Remote\\RemoteController@postDownload']);
$router->post('install', ['as' => 'remote.install', 'uses' => 'Remote\\RemoteController@postInstall']);
});
}
示例14: defineRoutes
private function defineRoutes()
{
$this->router->group(['prefix' => "dashboard/widget", 'namespace' => "Widget"], function () {
$this->router->model("widget_id", Widget::class);
$this->router->get("/", ["as" => 'widget.index', 'uses' => 'WidgetController@index']);
$this->router->post("/save-widget", ['as' => 'widget.save', 'uses' => 'WidgetController@save']);
$this->router->post("/delete-widget", ['as' => 'widget.delete', 'uses' => 'WidgetController@delete']);
});
}
示例15: defineRoutes
private function defineRoutes()
{
$this->router->group(['prefix' => '/', 'namespace' => 'Striped\\Controllers'], function () {
$this->router->get("/", ['as' => 'home', 'uses' => 'StripedController@home']);
$this->router->get("/article/{post_title}", ['as' => 'article', 'uses' => 'SingleController@single']);
$this->router->get("/page/{page_title}", ['as' => 'page', 'uses' => 'PageController@page']);
$this->router->post("/user/register", ['as' => 'register', 'uses' => 'UsersController@register']);
});
}