本文整理汇总了PHP中Illuminate\Routing\Router::controller方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::controller方法的具体用法?PHP Router::controller怎么用?PHP Router::controller使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Routing\Router
的用法示例。
在下文中一共展示了Router::controller方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: map
/**
* Define the routes for the application.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Router $router)
{
$router->controller('auth', 'Laraerp\\Http\\Controllers\\AuthController');
$router->controller('password', 'Laraerp\\Http\\Controllers\\PasswordController');
$router->group(array('namespace' => $this->namespace), function ($router) {
require app_path('Http/routes.php');
});
}
示例2: boot
public function boot(Router $router)
{
$this->commands(Install::class);
foreach ($this->routeMiddleware as $key => $middleware) {
$router->middleware($key, $middleware);
}
$groupOptions = ['namespace' => $this->namespace];
if (config('adminPanel.subDomain')) {
$groupOptions['domain'] = config('adminPanel.routePrefix') . '.' . preg_replace("/^(.*?)\\.(.*)\$/", "\$2", \Request::server('SERVER_NAME'));
} else {
$groupOptions['prefix'] = config('adminPanel.routePrefix');
}
$router->group($groupOptions, function (Router $router) {
$router->controller('auth', 'Auth\\AuthController', ['getRegister' => 'admin.register', 'getLogin' => 'admin.login', 'getLogout' => 'admin.logout']);
$router->group(['middleware' => 'ap.permission', 'permission' => config('adminPanel.ap_permission')], function (Router $route) {
$route->get('/', ['as' => 'admin.home', function () {
return view('adminPanel::hello');
}]);
$route->controller('ajax', 'AjaxController');
$route->resource('user', 'UserController', ['as' => 'admin']);
$route->model('role', config('entrust.role'));
$route->resource('role', 'RoleController', ['as' => 'admin']);
$route->model('permission', config('entrust.permission'));
$route->resource('permission', 'PermissionController', ['as' => 'admin']);
});
});
$this->loadViewsFrom(__DIR__ . '/../../resources/views', 'adminPanel');
$this->publishes([__DIR__ . '/../../config/config.php' => config_path('adminPanel.php')], 'config');
$this->publishes([__DIR__ . '/../../resources/assets' => base_path('resources/adminAssets')], 'assets');
$this->publishes([__DIR__ . '/../../migrations' => base_path('database/migrations')], 'migrate');
}
示例3: 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');
$constraints = array_pull($route, 'constraints', []);
array_set($route, 'streams::addon', $addon->getNamespace());
if (is_string($route['uses']) && !str_contains($route['uses'], '@')) {
$this->router->controller($uri, $route['uses']);
} else {
$this->router->{$verb}($uri, $route)->where($constraints);
}
}
}
示例4: 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;
}
});
}
示例5: boot
/**
* Bootstrap the application events.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function boot(Router $router)
{
$viewPath = __DIR__ . '/../resources/views';
$this->loadViewsFrom($viewPath, 'translation-manager');
$this->publishes([$viewPath => base_path('resources/views/vendor/translation-manager')], 'views');
$migrationPath = __DIR__ . '/../database/migrations';
$this->publishes([$migrationPath => base_path('database/migrations')], 'migrations');
$config = $this->app['config']->get('translation-manager.route', []);
$config['namespace'] = 'Barryvdh\\TranslationManager';
$router->group($config, function ($router) {
$router->get('view/{group}', 'Controller@getView');
$router->controller('/', 'Controller');
});
}
示例6: boot
/**
* Bootstrap the application events.
*
* @param \Illuminate\Routing\Router $router
*
* @return void
*/
public function boot(Router $router)
{
$resources = __DIR__ . '/../resources/';
$this->loadViewsFrom($resources . 'views', self::PACKAGE);
$this->loadTranslationsFrom($resources . 'lang', self::PACKAGE);
$this->publishes([$resources . 'views' => base_path('resources/views/vendor/' . self::PACKAGE)], 'views');
$this->publishes([$resources . 'lang' => base_path('resources/lang/vendor/' . self::PACKAGE)], 'lang');
$this->publishes([__DIR__ . '/../public' => public_path('vendor/' . self::PACKAGE)], 'public');
$migrationPath = __DIR__ . '/../database/migrations';
$this->publishes([$migrationPath => base_path('database/migrations')], 'migrations');
$config = $this->app['config']->get(self::PACKAGE . '.route', []);
$config['namespace'] = 'Vsch\\TranslationManager';
$router->group($config, function ($router) {
$router->get('view/{group}', 'Controller@getView');
$router->controller('/', 'Controller');
});
}
示例7: boot
public function boot(Router $router)
{
/*
|--------------------------------------------------------------------------
| Publish package resources
|--------------------------------------------------------------------------
*/
$this->publishes([__DIR__ . '/public/assets' => public_path('assets/toolbox')], 'assets');
$this->publishes([__DIR__ . '/resources/migrations' => base_path('database/migrations')], 'migrations');
/*
|--------------------------------------------------------------------------
| View path
|--------------------------------------------------------------------------
*/
$this->loadViewsFrom(__DIR__ . '/Views', 'admin');
/*
|--------------------------------------------------------------------------
| View composer
|--------------------------------------------------------------------------
*/
view()->composer('*', function ($view) {
$view->with('user', Auth::user());
});
/*
|--------------------------------------------------------------------------
| Middleware
|--------------------------------------------------------------------------
*/
$router->middleware('auth', Authenticate::class);
$router->middleware('logged', RedirectAuthenticated::class);
/*
|--------------------------------------------------------------------------
| Routes
|--------------------------------------------------------------------------
*/
$router->group(['middleware' => ['web'], 'prefix' => 'admin/'], function ($router) {
$router->controller('auth', $this->namespace . 'AuthController');
$router->group(['middleware' => ['auth']], function ($router) {
$router->any('{controller?}/{action?}/{id?}', function ($controller = 'home', $action = 'index', $id = null) {
return \App::make($this->namespace . $controller . 'Controller')->callAction($action, [$id]);
});
});
});
parent::boot($router);
}
示例8: controller
/**
* Route a controller to a URI with wildcard routing.
*
* @param string $uri
* @param string $controller
* @param array $names
* @return void
* @static
*/
public static function controller($uri, $controller, $names = array())
{
\Illuminate\Routing\Router::controller($uri, $controller, $names);
}
示例9: boot
/**
* Bootstrap the application events.
*
* @param \Illuminate\Routing\Router $router
* @param \Simexis\MultiLanguage\Manager $manager
* @return void
*/
public function boot(Router $router, Manager $manager)
{
$this->loadViewsFrom(__DIR__ . '/resources/views', 'multilanguage');
$this->loadTranslationsFrom(__DIR__ . '/Lang', 'multilanguage');
$this->publishes([__DIR__ . '/resources/views' => base_path('resources/views/vendor/multilanguage')], 'views');
$this->publishes([realpath(__DIR__ . '/migrations') => database_path('migrations')]);
$this->publishes([__DIR__ . '/Lang' => base_path('resources/lang')]);
//if tables exists
if ($this->checkTablesExists()) {
$config = $this->app['config']->get('multilanguage.route', []);
if (!isset($config['namespace'])) {
$config['namespace'] = 'Simexis\\MultiLanguage\\Controllers';
}
if (!isset($config['middleware']) && version_compare(app()->version(), '5.2', '>=')) {
$config['middleware'] = ['web'];
}
$router->group($config, function ($router) {
$router->get('view/{group}', 'MultilanguageController@getView');
$router->controller('/assets', 'AssetController');
$router->controller('/', 'MultilanguageController');
});
}
}
示例10: map
/**
* Define the routes for the application.
*
* @param Router $router
*/
public function map(Router $router)
{
$router->group(['namespace' => $this->namespace], function (Router $router) {
$router->get('/', 'HomeController@getIndex');
$router->get('logout', 'HomeController@getLogout');
$router->post('signin', 'HomeController@postSignin');
$router->group(['middleware' => 'auth'], function (Router $router) {
$router->get('dashboard', 'HomeController@getDashboard');
// Login user area
$router->controller('user', 'UserController');
// Projects area
$router->get('projects/{status?}', 'ProjectsController@getIndex')->where('status', '[0-1]');
$router->get('projects/new_issue', 'ProjectsController@getNewIssue');
$router->post('projects/new_issue', 'ProjectsController@postNewIssue');
$router->group(['middleware' => 'permission', 'permission' => 'project-create'], function (Router $router) {
$router->get('projects/new', 'ProjectsController@getNew');
$router->post('projects/new', 'ProjectsController@postNew');
});
$router->post('projects/progress', ['middleware' => 'ajax', 'uses' => 'ProjectsController@postProgress']);
$router->group(['middleware' => 'project'], function (Router $router) {
$router->model('project', 'Tinyissue\\Model\\Project');
$router->model('attachment', 'Tinyissue\\Model\\Project\\Issue\\Attachment');
$router->pattern('comment', '[0-9]+');
$router->pattern('issue', '[0-9]+');
$router->pattern('limit', '[0-9]+');
$router->model('comment', 'Tinyissue\\Model\\Project\\Issue\\Comment');
$router->pattern('project', '[0-9]+');
$router->pattern('attachment', '[0-9]+');
$router->pattern('note', '[0-9]+');
$router->pattern('term', '\\w+');
$router->model('note', 'Tinyissue\\Model\\Project\\Note');
// Tags autocomplete
$router->get('administration/tags/suggestions/{term?}', ['middleware' => 'ajax', 'uses' => 'Administration\\TagsController@getTags']);
// View project
$router->get('project/{project}', 'ProjectController@getIndex');
$router->get('project/{project}/issues/{status?}', 'ProjectController@getIssues')->where('status', '[0-1]');
$router->get('project/{project}/assigned', 'ProjectController@getAssigned');
$router->get('project/{project}/notes', 'ProjectController@getNotes');
// Edit project
$router->group(['middleware' => 'permission', 'permission' => 'project-modify'], function (Router $router) {
$router->get('project/{project}/edit', 'ProjectController@getEdit');
$router->post('project/{project}/edit', 'ProjectController@postEdit');
$router->get('project/inactive_users/{project?}', array('middleware' => 'ajax', 'uses' => 'ProjectController@getInactiveUsers'));
$router->post('project/{project}/unassign_user', array('middleware' => 'ajax', 'uses' => 'ProjectController@postUnassign'));
$router->post('project/{project}/assign_user', array('middleware' => 'ajax', 'uses' => 'ProjectController@postAssign'));
$router->post('project/{project}/export_issues', array('middleware' => 'ajax', 'uses' => 'ProjectController@postExportIssues'));
$router->get('project/{project}/download_export/{file}', array('uses' => 'ProjectController@getDownloadExport'));
// Edit project notes
$router->post('project/{project}/edit_note/{note}', ['middleware' => 'ajax', 'uses' => 'ProjectController@postEditNote']);
$router->get('project/{project}/delete_note/{note}', ['middleware' => 'ajax', 'uses' => 'ProjectController@getDeleteNote']);
$router->post('project/{project}/add_note', 'ProjectController@postAddNote');
});
// Add issue
$router->group(['middleware' => 'permission', 'permission' => 'issue-create'], function (Router $router) {
$router->get('project/{project}/issue/new', 'Project\\IssueController@getNew');
$router->post('project/{project}/issue/new', 'Project\\IssueController@postNew');
});
// View issue
$router->model('issue', 'Tinyissue\\Model\\Project\\Issue');
$router->group(['middleware' => 'permission', 'permission' => 'issue-view'], function (Router $router) {
$router->get('project/issue/{issue}', 'Project\\IssueController@getIndex');
$router->get('project/{project}/issue/{issue}', 'Project\\IssueController@getIndex');
$router->get('project/{project}/issue/{issue}/download/{attachment}', 'Project\\IssueController@getDownloadAttachment');
$router->get('project/{project}/issue/{issue}/display/{attachment}', 'Project\\IssueController@getDisplayAttachment');
});
// Edit issue
$router->group(array('middleware' => 'permission', 'permission' => 'issue-modify'), function (Router $router) {
$router->get('project/{project}/issue/{issue}/edit', 'Project\\IssueController@getEdit');
$router->post('project/{project}/issue/{issue}/edit', 'Project\\IssueController@postEdit');
$router->post('project/issue/{issue}/assign', ['middleware' => 'ajax', 'uses' => 'Project\\IssueController@postAssign']);
$router->get('project/{project}/issue/{issue}/status/{status?}', 'Project\\IssueController@getClose')->where('status', '[0-1]');
$router->post('project/{project}/issue/upload_attachment', 'Project\\IssueController@postUploadAttachment');
$router->post('project/{project}/issue/remove_attachment', 'Project\\IssueController@postRemoveAttachment');
$router->post('project/issue/{issue}/change_project', 'Project\\IssueController@postChangeProject');
// Edit comment
$router->post('project/issue/edit_comment/{comment}', ['middleware' => 'ajax', 'uses' => 'Project\\IssueController@postEditComment']);
$router->get('project/issue/delete_comment/{comment}', ['middleware' => 'ajax', 'uses' => 'Project\\IssueController@getDeleteComment']);
$router->post('project/{project}/issue/{issue}/add_comment', 'Project\\IssueController@getAddComment');
});
});
// Admin area
$router->group(['middleware' => 'permission', 'permission' => 'administration'], function (Router $router) {
$router->model('user', 'Tinyissue\\Model\\User');
$router->get('administration', 'AdministrationController@getIndex');
$router->get('administration/users', 'Administration\\UsersController@getIndex');
$router->get('administration/users/add', 'Administration\\UsersController@getAdd');
$router->post('administration/users/add', 'Administration\\UsersController@postAdd');
$router->get('administration/users/edit/{user}', 'Administration\\UsersController@getEdit');
$router->post('administration/users/edit/{user}', 'Administration\\UsersController@postEdit');
$router->get('administration/users/delete/{user}', 'Administration\\UsersController@getDelete');
// Tags
$router->model('tag', 'Tinyissue\\Model\\Tag');
$router->pattern('tag', '[0-9]+');
$router->get('administration/tags', 'Administration\\TagsController@getIndex');
$router->get('administration/tag/new', 'Administration\\TagsController@getNew');
//.........这里部分代码省略.........
示例11: _setupRoutes
protected function _setupRoutes(Router $router)
{
$router->group(['namespace' => 'Webpresso\\MyShortCart\\Http\\Controllers'], function ($router) {
$router->controller('myshortcart', 'PaymentController');
});
}
示例12: registerRoutes
/**
* Register the routes for this Admin Section.
*
* Default routes include, create:, read:, update:, delete:
*
* Also attempts to load in ModelAdminController
* based on the shortName of the class, for
* overloading and adding additional routes
*
* @param \Illuminate\Routing\Router $router
*/
public function registerRoutes(Router $router)
{
// We will need to throw an exception if a ModelAdmin manages a Model which conflicts with an internal flare endpoint
// such as (create, edit, view, delete etc)
$router->group(['prefix' => $this->urlPrefix(), 'namespace' => get_called_class(), 'as' => $this->urlPrefix()], function ($router) {
$this->registerSubRoutes();
$router->controller('/', $this->getController());
});
}