本文整理匯總了PHP中Illuminate\Routing\Router::resource方法的典型用法代碼示例。如果您正苦於以下問題:PHP Router::resource方法的具體用法?PHP Router::resource怎麽用?PHP Router::resource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Routing\Router
的用法示例。
在下文中一共展示了Router::resource方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: map
public function map(Router $router)
{
$router->group(['prefix' => 'andersonef'], function () use($router) {
$router->resource('componentes/animal', 'Andersonef\\Componentes\\Animal\\Controllers\\AnimalServiceController', ['only' => ['index']]);
$router->resource('server/componentes/animal', 'Andersonef\\Componentes\\Animal\\Controllers\\Server\\AnimalServiceController', ['only' => ['index']]);
});
}
示例2: map
public function map(Router $router)
{
$router->group(['prefix' => 'vendor-girolando', 'namespace' => 'Girolando\\Componentes\\Animal\\Http\\Controllers'], function () use($router) {
$router->resource('componentes/animal', 'AnimalServiceController', ['only' => ['index']]);
$router->resource('server/componentes/animal', 'Server\\AnimalServiceController', ['only' => ['index']]);
});
}
示例3: map
public function map(Router $router)
{
$router->group(['namespace' => 'Girolando\\Componentes\\' . self::$componente . '\\Http\\Controllers'], function () use($router) {
$router->resource(self::$routeModal, 'ClientController', ['only' => ['index']]);
$router->resource(self::$routeServer, 'ServerController', ['only' => ['index']]);
});
}
示例4: 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');
});
}
示例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) {
/**
* Front office routes
*/
if ($page = TypiCMS::getPageLinkedToModule('seminars')) {
foreach (config('translatable.locales') as $lang) {
$options = $page->private ? ['middleware' => 'auth'] : [];
if ($uri = $page->uri($lang)) {
$router->get($uri, $options + ['as' => $lang . '.seminars', 'uses' => 'PublicController@index']);
$router->get($uri . '/{slug}', $options + ['as' => $lang . '.seminars.slug', 'uses' => 'PublicController@show']);
$router->get($uri . '/{slug}/ics', $options + ['as' => $lang . '.seminars.slug.ics', 'uses' => 'PublicController@ics']);
}
}
}
/**
* Admin routes
*/
$router->resource('admin/seminars', 'AdminController');
/**
* API routes
*/
$router->resource('api/seminars', 'ApiController');
});
}
示例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) {
/*
* Admin routes
*/
$router->resource('admin/menus.menulinks', 'AdminController');
$router->post('admin/menulinks/sort', ['as' => 'admin.menulinks.sort', 'uses' => 'AdminController@sort']);
/*
* API routes
*/
$router->resource('api/menulinks', 'ApiController');
});
}
示例7: registerRoutes
/**
* Register the addon routes.
*
* @param AddonServiceProvider $provider
* @param Addon $addon
*/
protected function registerRoutes(AddonServiceProvider $provider, Addon $addon)
{
if ($this->routesAreCached()) {
return;
}
if (!($routes = $provider->getRoutes())) {
return;
}
foreach ($routes as $uri => $route) {
/*
* If the route definition is an
* not an array then let's make it one.
* Array type routes give us more control
* and allow us to pass information in the
* request's route action array.
*/
if (!is_array($route)) {
$route = ['uses' => $route];
}
$verb = array_pull($route, 'verb', 'any');
$middleware = array_pull($route, 'middleware', []);
$constraints = array_pull($route, 'constraints', []);
array_set($route, 'streams::addon', $addon->getNamespace());
if (is_string($route['uses']) && !str_contains($route['uses'], '@')) {
$this->router->resource($uri, $route['uses']);
} else {
$route = $this->router->{$verb}($uri, $route)->where($constraints);
if ($middleware) {
call_user_func_array([$route, 'middleware'], (array) $middleware);
}
}
}
}
示例8: 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->group(['before' => 'ui|csfr', 'middleware' => 'theme'], function ($router) {
// $router->get('session/start', array('as' => 'session.start', 'uses' => 'SessionController@getStart'));
// $router->post('session/start', array('as' => 'session.post', 'uses' => 'SessionController@postStart'));
$router->resource('session', 'SessionController', ['only' => ['store', 'create', 'index']]);
$router->group(array('middleware' => 'auth'), function ($router) {
// $router->get('session/end', array('as' => 'session.end', 'uses' => 'SessionController@getEnd'));
$router->get('/', array('as' => 'dash.index', 'uses' => 'DashController@getIndex'));
$router->get('me/time', array('as' => 'me.time.index', 'uses' => 'TimeController@index'));
$router->post('me/time/store', array('as' => 'me.time.store', 'uses' => 'TimeController@store'));
$router->get('me/time/{id}/edit', array('as' => 'me.time.edit', 'uses' => 'TimeController@edit'));
$router->put('me/time/{id}', array('as' => 'me.time.update', 'uses' => 'TimeController@update'));
$router->get('me/time/{id}/delete', array('as' => 'me.time.delete', 'uses' => 'TimeController@delete'));
$router->delete('me/time/{id}', array('as' => 'me.time.destroy', 'uses' => 'TimeController@destroy'));
$router->resource('tickets', 'TicketsController', ['except' => ['destroy']]);
$router->resource('actions', 'TicketActionsController', ['only' => ['store']]);
$router->resource('reports', 'ReportsController', ['only' => ['index', 'show']]);
$router->resource('dev', 'DevController', ['only' => ['index']]);
});
});
$router->group(['namespace' => 'Api', 'prefix' => 'api', 'before' => 'auth|csfr'], function ($router) {
$router->resource('users', 'UsersController', ['except' => ['create', 'store', 'edit', 'update', 'destroy']]);
$router->resource('tickets', 'TicketsController', ['except' => ['index', 'create', 'store', 'show', 'edit', 'destroy']]);
});
});
}
示例9: 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']);
});
});
}
示例10: map
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Cocona $cocona, Router $router)
{
$router->group(['namespace' => $this->namespace, 'prefix' => 'cocona'], function (Router $router) use($cocona) {
$router->resource('example-resource', 'ResourceController');
$router->controller('/', 'InstallController', ['getRequirements' => 'get.cocona.install.requirements', 'getDatabase' => 'get.cocona.install.database', 'getInstall' => 'get.cocona.install.install', 'getDone' => 'get.cocona.install.done']);
if ($cocona->isInstalled()) {
return;
}
});
}
示例11: 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();
}
示例12: map
public function map(Router $router)
{
$router->group(['middleware' => 'web'], function () use($router) {
$router->group(['prefix' => config('avalon-admin.adminPath', 'avalon/admin')], function () use($router) {
$router->group(['prefix' => 'panel', 'middleware' => AuthMiddleware::class], function () use($router) {
//dashboard
$router->resource('/', DashboardController::class, ['only' => ['index'], 'names' => ['index' => 'avalon.admin.panel.dashboard.index']]);
//Logout
$router->get('/logout', ['as' => 'avalon.admin.auth.destroy', 'uses' => AuthController::class . '@destroy']);
//User Management
$router->resource('/users', UsersController::class, ['names' => ['index' => 'avalon.admin.panel.users.index', 'create' => 'avalon.admin.panel.users.create', 'store' => 'avalon.admin.panel.users.store', 'update' => 'avalon.admin.panel.users.update', 'edit' => 'avalon.admin.panel.users.edit', 'destroy' => 'avalon.admin.panel.users.destroy']]);
//Parameter Management
$router->resource('/parameters', ParametersController::class, ['names' => ['index' => 'avalon.admin.panel.parameters.index', 'create' => 'avalon.admin.panel.parameters.create', 'store' => 'avalon.admin.panel.parameters.store', 'update' => 'avalon.admin.panel.parameters.update', 'edit' => 'avalon.admin.panel.parameters.edit', 'destroy' => 'avalon.admin.panel.parameters.destroy']]);
//Category Management
$router->resource('/categories', CategoriesController::class, ['names' => ['index' => 'avalon.admin.panel.categories.index', 'create' => 'avalon.admin.panel.categories.create', 'store' => 'avalon.admin.panel.categories.store', 'update' => 'avalon.admin.panel.categories.update', 'edit' => 'avalon.admin.panel.categories.edit', 'destroy' => 'avalon.admin.panel.categories.destroy']]);
});
$router->resource('/', AuthController::class, ['only' => ['index', 'store', 'destroy'], 'names' => ['index' => 'avalon.admin.auth.index', 'store' => 'avalon.admin.auth.store']]);
});
});
}
示例13: 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) {
$router->get('/', function (Router $router) {
return $router->dispatch(Request::create('product', 'GET', []));
});
$router->get('/about-us', function () {
return view('about-us', ['navActive' => 'about-us']);
});
$router->resource('/product', 'ProductController', ['except' => ['show']]);
$router->resource('/category', 'CategoryController', ['except' => ['index']]);
$router->resource('/cart', 'CartController', ['only' => ['index', 'store', 'destroy']]);
$router->resource('/order', 'OrderController', ['only' => ['index', 'store', 'update']]);
$router->get('order/history', 'OrderController@history');
$router->get('/search', 'ProductController@search');
$router->get('/login', 'Auth\\AuthController@getLogin');
$router->post('/login', 'Auth\\AuthController@postLogin');
$router->get('/logout', 'Auth\\AuthController@getLogout');
$router->get('/register', 'Auth\\AuthController@getRegister');
$router->post('/register', 'Auth\\AuthController@postRegister');
$router->get('/account/edit', 'Auth\\AuthController@edit');
$router->put('/account/edit', 'Auth\\AuthController@update');
});
}
示例14: 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->get('/', array('as' => 'dash.index', 'uses' => 'DashController@getIndex'));
$router->resource('session', 'SessionController', ['only' => ['store', 'create', 'index']]);
$router->group(array('middleware' => 'auth'), function ($router) {
$router->resource('tickets', 'TicketsController', ['except' => ['destroy']]);
$router->resource('actions', 'TicketActionsController', ['only' => ['store']]);
$router->resource('reports', 'ReportsController', ['only' => ['index', 'show']]);
$router->get('settings/{type}', ['as' => 'settings.edit', 'uses' => 'SettingsController@edit'])->where('type', 'emails|system|notifications');
$router->put('settings/{type}', ['as' => 'settings.update', 'uses' => 'SettingsController@update'])->where('type', 'emails|system|notifications');
$router->resource('system/logs', 'LogsController', ['only' => ['index', 'show']]);
$router->group(['prefix' => 'me'], function ($router) {
$router->resource('time', 'TimeController');
});
});
$router->group(['namespace' => 'Api', 'prefix' => 'api', 'middleware' => 'auth'], function ($router) {
$router->resource('users', 'UsersController', ['except' => ['create', 'edit', 'destroy']]);
// $router->resource('staff', 'StaffController', ['except' => ['create', 'store', 'edit', 'update', 'destroy']]);
$router->resource('tickets', 'TicketsController', ['except' => ['index', 'create', 'store', 'show', 'edit', 'destroy']]);
});
});
}
示例15: resource
/**
* Route a resource to a controller.
*
* @param string $name
* @param string $controller
* @param array $options
* @return void
* @static
*/
public static function resource($name, $controller, $options = array())
{
\Illuminate\Routing\Router::resource($name, $controller, $options);
}