本文整理汇总了PHP中Illuminate\Routing\Router::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::get方法的具体用法?PHP Router::get怎么用?PHP Router::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Routing\Router
的用法示例。
在下文中一共展示了Router::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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)));
});
});
});
}
示例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) {
/**
* 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');
});
}
示例3: 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']);
});
}
示例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: boot
public function boot(Router $router)
{
$this->commands(Install::class);
foreach ($this->routeMiddleware as $key => $middleware) {
$router->middleware($key, $middleware);
}
$router->group(['middleware' => ['web'], 'namespace' => $this->namespace, 'prefix' => config('adminPanel.routePrefix'), 'as' => 'admin.'], function (Router $router) {
$router->get('auth/register', ['as' => 'register', 'uses' => 'Auth\\AuthController@getRegister']);
$router->get('auth/login', ['as' => 'login', 'uses' => 'Auth\\AuthController@getLogin']);
$router->post('auth/login', ['as' => 'login', 'uses' => 'Auth\\AuthController@postLogin']);
$router->get('auth/logout', ['as' => 'logout', 'uses' => 'Auth\\AuthController@getLogout']);
$router->group(['middleware' => ['role:admin']], function (Router $route) {
$route->get('/', ['as' => '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');
}
示例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) {
/*
* 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');
});
}
示例7: 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']]);
});
});
}
示例8: 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);
}
示例9: 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/_locale/{locale}', 'LocaleController@setContentLocale')->name('admin::change-locale');
});
/*
* Api routes
*/
$router->get('admin/duplicate/{alias}/{resource}', function ($alias, $resource) {
$repository = app(ucfirst($alias));
$oldItem = $repository::make()->skip()->find($resource);
$newItem = $oldItem->replicate();
if (isset($newItem->system_name)) {
$newItem->system_name .= ' (copy)';
}
unset($newItem->translations);
unset($newItem->translatedAttributes);
dd($newItem->getAttributes());
$newItem = $newItem->create($newItem->getAttributes());
foreach ($oldItem->translations as $translation) {
$parent_id = $oldItem->getRelationKey();
$translation->{$parent_id} = $newItem->id;
if (isset($translation->title)) {
$translation->title .= ' (copy)';
}
$translation = $translation->replicate();
$translation->save();
}
return redirect(URL::previous());
});
}
示例10: run
public function run()
{
$router = new Router(new Dispatcher($this->container), $this->container);
$router->get('/', HomeController::class . '@index');
$router->get('/responsabilidad/{id}', HomeController::class . '@show');
$response = $router->dispatch(Request::capture());
$response->send();
}
示例11: registerRoutes
/**
* @param \Illuminate\Routing\Router $router
*/
protected function registerRoutes(Router $router)
{
$router->group(['namespace' => 'Atrauzzi\\LaravelOauth2Server\\Http\\Controller', 'prefix' => 'oauth2'], function (Router $router) {
$router->get('authorize', ['as' => 'oauth2.create-authorization', 'uses' => 'Authorization@create', 'middleware' => 'auth']);
$router->get('invalid-authorization', ['as' => 'oauth2.invalid-authorization', 'uses' => 'Authorization@invalid']);
$router->post('authorize', ['as' => 'oauth2.store-authorization', 'uses' => 'Authorization@store', 'middleware' => 'auth']);
});
}
示例12: adminRoutes
private function adminRoutes(Router $router)
{
$router->get('/', 'NewsAdminController@index')->name('index');
$router->get('/create', 'NewsAdminController@create')->name('create');
$router->post('/', 'NewsAdminController@store')->name('store');
$router->get('/{article}', 'NewsAdminController@edit')->name('edit');
$router->put('/{article}', 'NewsAdminController@update')->name('update');
$router->delete('/{article}', 'NewsAdminController@destroy')->name('destroy');
}
示例13: init
/**
* @return void
*/
public final function init()
{
if (is_null($this->path) || is_null($this->handler)) {
throw new \InvalidArgumentException('Handler or Path must be Setted!');
}
$this->router->group(['middleware' => 'web'], function () {
$this->router->get($this->path, $this->handler);
});
}
示例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']);
});
}