本文整理汇总了PHP中Route::when方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::when方法的具体用法?PHP Route::when怎么用?PHP Route::when使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Route
的用法示例。
在下文中一共展示了Route::when方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
Route::get('reports/clearCache', 'ReportsController@clearCache');
Route::get('reports/', 'ReportsController@speciesByMonth');
Route::get('reports/speciesByMonth', 'ReportsController@speciesByMonth');
Route::get('reports/speciesByYear', 'ReportsController@speciesByYear');
Route::get('reports/speciesForMonth/{monthNumber}', 'ReportsController@speciesForMonth');
Route::get('reports/speciesForYear/{year}', 'ReportsController@speciesForYear');
Route::get('reports/speciesDetail/{speciesId}', 'ReportsController@speciesDetail');
Route::get('reports/speciesByOrder', 'ReportsController@speciesByOrder');
Route::get('reports/speciesForOrder/{orderId}', 'ReportsController@speciesForOrder');
Route::get('reports/speciesAll', 'ReportsController@speciesAll');
Route::get('reports/searchAll', 'ReportsController@searchAll');
Route::get('reports/speciesByLocation', 'ReportsController@speciesByLocation');
Route::get('reports/speciesForLocation/{locationId}', 'ReportsController@speciesForLocation');
Route::get('reports/birdLookup', 'ReportsController@birdLookup');
// posts, puts, and deletes require csrf check
Route::when('*', 'csrf', ['post', 'put', 'delete']);
// login and logout routes not requiring authentication
Route::get('login', 'AdminController@login');
Route::post('login', 'AdminController@authenticate');
Route::get('logout', 'AdminController@logout');
// admin routes all require authenticated user
Route::group(['prefix' => 'admin', 'before' => 'auth'], function () {
Route::get('logout', 'AdminController@unauthenticate');
Route::get('menu', 'AdminController@menu');
Route::get('clearCache', 'AdminController@clearCache');
Route::get('trips/{id}/sightings', 'TripController@sightings');
Route::resource('sightings', 'SightingController');
Route::resource('trips', 'TripController');
Route::resource('locations', 'LocationController');
Route::get('sendTestMailSwift', 'MailController@sendTestMailSwift');
Route::get('sendTestMailLaravel', 'MailController@sendTestMailLaravel');
示例2: Routes
* Frontend Routes
* ------------------------------------------
*/
// Confide routes
Route::get('users/register', 'UsersController@create');
Route::get('users/create', 'UsersController@create');
Route::post('users', 'UsersController@store');
Route::get('users/login', 'UsersController@login');
Route::post('users/login', 'UsersController@doLogin');
Route::get('users/confirm/{code}', 'UsersController@confirm');
Route::get('users/forgot_password', 'UsersController@forgotPassword');
Route::post('users/forgot_password', 'UsersController@doForgotPassword');
Route::get('users/reset_password/{token}', 'UsersController@resetPassword');
Route::post('users/reset_password', 'UsersController@doResetPassword');
Route::get('users/logout', 'UsersController@logout');
# User RESTful Routes (Login, Logout, Register, etc)
Route::controller('users', 'UsersController');
//:: Application Routes ::
# Filter for detect language
Route::when('contact-us', 'detectLang');
# Contact Us Static Page
Route::get('contact-us', function () {
// Return about us page
return View::make('site/contact-us');
});
# Posts - Second to last set, match slug
Route::get('{postSlug}', 'BlogController@getView');
Route::post('{postSlug}', 'BlogController@postView');
# Index Page - Last route, no matches
Route::get('/', array('before' => 'detectLang', 'uses' => 'UsersController@login'));
#Route::get('/', array('before' => 'detectLang','uses' => 'BlogController@getIndex')); #route asli
示例3: function
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
/*
#Laravel 5.1 默认路由
Route::get('/', function () {
return view('welcome');
});
*/
//added some test routes
#对后台开启csrf过滤
Route::when('admin/*', 'csrf', ['post', 'delete', 'put']);
Route::any('cp', function () {
return Response::view('cp');
});
/*
|--------------------------------------------------------------------------
| 基础权限 登录注册找回密码等操作
|--------------------------------------------------------------------------
*/
Route::group(['prefix' => 'auth'], function () {
$Authority = 'AuthorityController@';
# 退出
Route::get('logout', ['as' => 'logout', 'uses' => $Authority . 'getLogout']);
# 登录
Route::get('login', ['as' => 'login', 'uses' => $Authority . 'getLogin']);
Route::post('login', $Authority . 'postLogin');
示例4: array
|
| The following filters are developed for larapress but may be also useful
| for your website. You can apply them to any route you'd like.
|
*/
Route::filter('force.human', 'Larapress\\Filters\\Special\\ForceHumanFilter');
/*
|--------------------------------------------------------------------------
| Filters for the larapress backend
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application and has the required permissions
| for several tasks.
|
*/
Route::filter('access.backend', 'Larapress\\Filters\\Backend\\AccessBackendFilter');
Route::filter('force.ssl', 'Larapress\\Filters\\Backend\\ForceSSLFilter');
/*
|--------------------------------------------------------------------------
| Pattern Filters for the larapress backend
|--------------------------------------------------------------------------
|
| The following filters are used to define when to use larapress's filters.
|
*/
$backend_url = Config::get('larapress.urls.backend');
Route::when($backend_url . '/cp*', 'access.backend');
Route::when($backend_url . '/reset-password', 'force.human', array('post'));
Route::when($backend_url . '*', 'force.ssl');
示例5: function
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::controllers(['auth' => 'Auth\\AuthController']);
Route::resource('posts', 'PostController');
Route::resource('comments', 'CommentController');
Route::get('/', function () {
return view('welcome');
});
Route::filter('manage_posts', function () {
if (!Entrust::hasRole('admin')) {
return Redirect::to('/posts');
}
});
Route::when('posts*', 'manage_posts', array('post', 'put', 'delete'));
Route::when('posts/create', 'manage_posts');
Route::when('posts/*/edit', 'manage_posts');
示例6: function
Route::get('admin/tag/create', 'Admin\\TagController@create');
Route::post('admin/tag/store', 'Admin\\TagController@store');
Route::get('admin/tag/edit/{id}', 'Admin\\TagController@edit');
Route::post('admin/tag/update/{id}', ['as' => 'admin.tag.update', 'uses' => 'Admin\\TagController@update']);
/*
Route::group(['prefix' => 'admin', 'middleware' => ['role:admin']], function() {
Route::get('/', 'AdminController@welcome');
Route::get('/manage', ['middleware' => ['permission:manage-admins'], 'uses' => 'AdminController@manageAdmins']);
});*/
Route::filter('manage_posts', function () {
// check the current user
if (!Entrust::hasRole('admin')) {
return Redirect::to('/');
}
});
Route::when('admin/role*', 'manage_posts');
// Route::get('admin/attribute/index','Admin\AttributeController@index');
//属性
Route::get('admin/attribute/index', 'Admin\\AttributeController@index');
//Route::get('admin/attribute/index/{id}', 'Admin\AttributeController@index');
Route::post('admin/attribute/save', 'Admin\\AttributeController@save');
Route::get('admin/attribute/create', 'Admin\\AttributeController@create');
Route::get('admin/attribute/attrlist/{id}', 'Admin\\AttributeController@attrlist');
Route::get('admin/attribute/edit/{id}', 'Admin\\AttributeController@edit');
Route::post('admin/attribute/store/{id}', ['as' => 'admin.attribute.store', 'uses' => 'Admin\\AttributeController@store']);
//商品
Route::get('admin/itemcat/index', 'Admin\\ItemCatController@index');
Route::get('admin/item/index', 'Admin\\ItemController@index');
Route::post('admin/item/save', 'Admin\\ItemController@save');
Route::get('admin/item/select', 'Admin\\ItemController@select');
//商品类型
示例7: function
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
//////////////////QUAN LY DASHBOARD//////////////////////////////////
Route::post('/quanly/checklogin', 'quanly\\DashboardController@checklogin');
Route::group(['before' => 'authS|kiemtraquyen'], function () {
Route::get('/quanly', function () {
return View::make('quanly.dashboard');
});
Route::when('/quanly/*', 'csrf', array('post'));
Route::get('/quanly/logout', 'quanly\\DashboardController@logout');
//TIN TUC
Route::get('/quanly/tintuc', 'quanly\\AdminTinTucController@index');
Route::post('/quanly/tintuc/delete/', 'quanly\\AdminTinTucController@delete');
Route::get('/quanly/tintuc/edit/{id}', 'quanly\\AdminTinTucController@edit');
Route::get('/quanly/tintuc/add', 'quanly\\AdminTinTucController@add');
Route::post('/quanly/tintuc/save', 'quanly\\AdminTinTucController@save');
Route::post('/quanly/tintuc/storage', 'quanly\\AdminTinTucController@storage');
//CHUYEN MUC
Route::get('/quanly/chuyenmuc', 'quanly\\AdminChuyenmucController@index');
Route::get('/quanly/chuyenmuc/add', 'quanly\\AdminChuyenmucController@add');
Route::post('/quanly/chuyenmuc/storage', 'quanly\\AdminChuyenmucController@storage');
Route::post('/quanly/chuyenmuc/delete', 'quanly\\AdminChuyenmucController@delete');
Route::post('/quanly/chuyenmuc/save', 'quanly\\AdminChuyenmucController@save');
Route::get('/quanly/chuyenmuc/edit/{id}', 'quanly\\AdminChuyenmucController@edit');
示例8: function
$admin = Auth::admin()->get()->name;
return Redirect::route('admin.index', ['admin' => $admin]);
}
return View::make('login');
}]);
Route::get('login', function () {
if (Auth::user()->check()) {
$user = Auth::user()->get()->name;
return Redirect::route('admin.index', ['user' => $user]);
} elseif (Auth::admin()->check()) {
$admin = Auth::admin()->get()->name;
return Redirect::route('admin.index', ['admin' => $admin]);
}
return View::make('login');
});
Route::post('/', ['as' => 'user.login', 'uses' => 'UsersController@login']);
Route::get('logout', ['as' => 'user.logout', 'uses' => 'UsersController@logout']);
Route::get('users/create', ['as' => 'users.create', 'uses' => 'UsersController@create']);
Route::post('users', ['as' => 'users.store', 'uses' => 'UsersController@store']);
Route::get('admin/{admin}', ['as' => 'admin.index', 'uses' => 'AdminsController@index']);
Route::resource('admin.users', 'UsersController', ['except' => ['edit', 'update']]);
Route::resource('admin.units', 'UnitsController');
Route::resource('admin.subjects', 'SubjectsController', ['except' => 'create']);
Route::get('admin/{admin}/subjects/{subject}/create', ['as' => 'admin.subjects.create', 'uses' => 'SubjectsController@create']);
Route::get('admin/{admin}/db_backup', ['as' => 'admin.db_backup', 'uses' => 'AdminsController@db_backup']);
Route::get('admin/{admin}/db_restore', ['as' => 'admin.db_restore', 'uses' => 'AdminsController@db_restore']);
Route::get('admin/{admin}/help', ['as' => 'admin.help', 'uses' => 'AdminsController@help']);
Route::get('admin/{admin}/transactions', ['as' => 'admin.transactions', 'uses' => 'AdminsController@transactions']);
Route::get('admin/{admin}/delete_transactions', ['as' => 'admin.delete.transactions', 'uses' => 'AdminsController@delete_transactions']);
Route::when('admin*', ['before' => 'auth']);
示例9: function
<?php
// Route filters
Route::when('admin/*', 'admin');
Route::when('*', 'trick.view_throttle');
// Route patterns
Route::pattern('tag_slug', '[a-z0-9\\-]+');
Route::pattern('trick_slug', '[a-z0-9\\-]+');
// Admin routes
Route::group(['prefix' => 'admin', 'namespace' => 'Controllers\\Admin'], function () {
Route::controller('tags', 'TagsController', ['getIndex' => 'admin.tags.index', 'getView' => 'admin.tags.view']);
Route::controller('categories', 'CategoriesController', ['getIndex' => 'admin.categories.index', 'getView' => 'admin.categories.view']);
Route::controller('users', 'UsersController');
});
Route::group(['namespace' => 'Controllers'], function () {
// Home routes
Route::get('/', ['as' => 'browse.recent', 'uses' => 'BrowseController@getBrowseRecent']);
Route::get('popular', ['as' => 'browse.popular', 'uses' => 'BrowseController@getBrowsePopular']);
Route::get('comments', ['as' => 'browse.comments', 'uses' => 'BrowseController@getBrowseComments']);
Route::get('about', ['as' => 'about', 'uses' => 'HomeController@getAbout']);
// Trick routes
Route::get('tricks/{trick_slug?}', ['as' => 'tricks.show', 'uses' => 'TricksController@getShow']);
Route::post('tricks/{trick_slug}/like', ['as' => 'tricks.like', 'uses' => 'TricksController@postLike']);
// Browse routes
Route::get('categories', ['as' => 'browse.categories', 'uses' => 'BrowseController@getCategoryIndex']);
Route::get('categories/{category_slug}', ['as' => 'tricks.browse.category', 'uses' => 'BrowseController@getBrowseCategory']);
Route::get('tags', ['as' => 'browse.tags', 'uses' => 'BrowseController@getTagIndex']);
Route::get('tags/{tag_slug}', ['as' => 'tricks.browse.tag', 'uses' => 'BrowseController@getBrowseTag']);
// Search routes
Route::get('search', 'SearchController@getIndex');
// Sitemap route
示例10: function
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::when('*', 'www');
Route::group(['domain' => Config::get('app.domain')], function () {
Route::get('/notifs/{last}', ['as' => 'notifs', 'uses' => 'HomeController@notifs'])->before('auth');
Route::get('/notifcount', ['as' => 'notifcount', 'uses' => 'HomeController@notifCount'])->before('auth');
Route::get('/markasread/{id}', ['as' => 'markasread', 'uses' => 'HomeController@markAsRead'])->before('auth');
Route::get('/deletenotify/{id}', ['as' => 'deletenotify', 'uses' => 'HomeController@deleteNotify'])->before('auth');
Route::get('/', ['as' => 'home', 'uses' => 'HomeController@showWelcome']);
Route::get('/search', ['as' => 'search', 'uses' => 'HomeController@search']);
Route::get('/login', ['as' => 'login', 'uses' => 'HomeController@loginView'])->before('guest');
Route::post('/login', ['uses' => 'HomeController@login'])->before('guest');
Route::get('/register', ['as' => 'register', 'uses' => 'HomeController@registerView'])->before('guest');
Route::post('/register', ['uses' => 'HomeController@register'])->before('guest');
Route::get('/logout', ['as' => 'logout', 'uses' => 'HomeController@logout'])->before('auth');
Route::get('/pickcomment/{id}', ['as' => 'pickcomment', 'uses' => 'PostController@pickComment'])->before('auth');
Route::get('/removecomment', ['as' => 'removecomment', 'uses' => 'PostController@removeComment'])->before('auth');
Route::get('/subtitle/create', ['as' => 'subtitle.create', 'uses' => 'SubtitleController@createSubtitleView'])->before('auth');
Route::post('/subtitle/create', ['uses' => 'SubtitleController@createSubtitle'])->before('auth');
Route::get('/subtitle/delete/{id}', ['as' => 'subtitle.delete', 'uses' => 'SubtitleController@deleteSubtitle'])->before('auth');
Route::get('/post/delete/{id}', ['as' => 'post.delete', 'uses' => 'PostController@deletePost'])->before('auth');
示例11: config
<?php
Route::when('*', 'csrf', ['POST', 'PUT', 'PATCH', 'DELETE']);
Route::group(['prefix' => config('_auth.routes_prefix')], function () {
Route::group(['middleware' => ['guest', 'honeypot']], function () {
Route::get(config('_auth.login.route'), ['as' => 'login.index', 'uses' => 'Cerbero\\Auth\\Http\\Controllers\\AuthController@showLogin']);
Route::post(config('_auth.login.route'), ['as' => 'login.store', 'uses' => 'Cerbero\\Auth\\Http\\Controllers\\AuthController@login']);
Route::get(config('_auth.register.route'), ['as' => 'register.index', 'uses' => 'Cerbero\\Auth\\Http\\Controllers\\AuthController@showRegister']);
Route::post(config('_auth.register.route'), ['as' => 'register.store', 'uses' => 'Cerbero\\Auth\\Http\\Controllers\\AuthController@register']);
Route::get(config('_auth.recover.route'), ['as' => 'recover.index', 'uses' => 'Cerbero\\Auth\\Http\\Controllers\\AuthController@showRecover']);
Route::post(config('_auth.recover.route'), ['as' => 'recover.store', 'uses' => 'Cerbero\\Auth\\Http\\Controllers\\AuthController@recover']);
Route::get(config('_auth.reset.route') . '/{token}', ['as' => 'reset.index', 'uses' => 'Cerbero\\Auth\\Http\\Controllers\\AuthController@showReset']);
Route::post(config('_auth.reset.route') . '/{token}', ['as' => 'reset.store', 'uses' => 'Cerbero\\Auth\\Http\\Controllers\\AuthController@reset']);
});
Route::group(['middleware' => 'auth'], function () {
Route::get(config('_auth.logout.route'), ['as' => 'logout', 'uses' => 'Cerbero\\Auth\\Http\\Controllers\\AuthController@logout']);
});
});
示例12: function
Route::pattern('any', '(.*)');
Route::get('css/{any}', 'MiscFileController@getCSS');
Route::get('js/{any}', 'MiscFileController@getJS');
Route::get('images/{any}', 'MiscFileController@getImg');
Route::get('addons/{any}', 'MiscFileController@getAddOn');
/*********** FILTER ***********/
Route::filter('office', function () {
$path = Request::path();
if ($path != 'office/login') {
if (!SysUser::chkLogin()) {
$re = Tools::reFalse(10003, '请先登录');
return Response::json($re);
}
}
});
Route::when('office/*', 'office');
/*********** FILTER ***********/
/*********** IMG ***********/
Route::post('img', 'ImgController@postImg');
/*********** IMG ***********/
/*********** API ***********/
/* V1 */
Route::group(['domain' => Config::get('app.subdomain.api')], function () {
/* APP START*/
Route::get('app/config', 'AppController@getConfig');
Route::get('app/download', 'AppController@getDownloadLink');
Route::post('v0/app/feedback', 'AppController@postFeedback');
/* APP END*/
/* ME START*/
Route::get('v0/user/me', 'MeController@me');
Route::get('v0/user/me/notification', 'MeNotificationController@listNots');
示例13: foreach
<?php
/**
* Register routes filter classes
*/
Route::filter('public.checkLocale', 'TypiCMS\\Filters\\PublicFilter@checkLocale');
Route::filter('admin.setLocale', 'TypiCMS\\Filters\\AdminFilter@setLocale');
Route::filter('visitor.publicAccess', 'TypiCMS\\Filters\\UsersFilter@publicAccess');
Route::filter('visitor.mayRegister', 'TypiCMS\\Filters\\UsersFilter@mayRegister');
Route::filter('user.auth', 'TypiCMS\\Filters\\UsersFilter@auth');
Route::filter('user.hasAccess', 'TypiCMS\\Filters\\UsersFilter@hasAccess');
Route::filter('user.inGroup', 'TypiCMS\\Filters\\UsersFilter@inGroup');
/**
* Route filter "public"
*/
foreach (Config::get('app.locales') as $locale) {
Route::when($locale, 'public.checkLocale');
Route::when($locale . '/*', 'public.checkLocale');
}
/**
* Route filter admin side
*/
Route::when('admin', 'admin.setLocale|user.auth|user.hasAccess');
Route::when('admin/*', 'admin.setLocale|user.auth|user.hasAccess');
示例14: function
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::when('admin/*', 'csrf', ['post']);
Route::pattern('id', '[0-9]+');
Route::pattern('image', '([^\\s]+(\\.(?i)(jpg|png|gif|bmp|jpeg|tiff))$)');
Route::group(['namespace' => 'Controllers\\Admin', 'prefix' => 'admin'], function () {
Route::group(['before' => 'auth'], function () {
Route::group(['prefix' => 'api/v1', 'namespace' => 'Api\\V1'], function () {
Route::post('roles', ['uses' => 'RoleController@store', 'as' => 'admin.api.v1.roles.store']);
Route::post('articles', ['uses' => 'ArticleController@store', 'as' => 'admin.api.v1.articles.store']);
Route::put('users/me-update', ['uses' => 'UserController@profileUpdate', 'as' => 'admin.api.v1.users.profile_update']);
Route::post('article_states', ['uses' => 'StateController@store', 'as' => 'admin.api.v1.article_states.store']);
Route::put('article_states/{id}', ['uses' => 'StateController@update', 'as' => 'admin.api.v1.article_states.update']);
Route::post('roles', ['uses' => 'RoleController@store', 'as' => 'admin.api.v1.roles.store']);
Route::post('articles', ['uses' => 'ArticleController@store', 'as' => 'admin.api.v1.articles.store']);
Route::put('users/me-update', ['uses' => 'UserController@profileUpdate', 'as' => 'admin.api.v1.users.profile_update']);
Route::put('articles/update', ['uses' => 'ArticleController@update', 'as' => 'admin.api.v1.articles.update']);
});
Route::get('/dash', ['uses' => 'DashboardController@index', 'as' => 'admin.dash.index']);
Route::get('/logout', ['uses' => 'AuthController@getLogout', 'as' => 'admin.auth.logout']);
Route::get('/me', ['uses' => 'UserController@meEdit', 'as' => 'admin.profile']);
示例15: function
Route::when('roadmap', 'detectLang');
Route::get('roadmap', function () {
// Return about us page
return View::make('site/static/roadmap');
});
Route::when('data-security', 'detectLang');
Route::get('data-security', function () {
// Return about us page
return View::make('site/static/data-security');
});
Route::when('devops', 'detectLang');
Route::get('devops', function () {
// Return about us page
return View::make('site/static/devops');
});
Route::when('videos', 'detectLang');
Route::get('videos', function () {
// Return about us page
return View::make('site/static/videos');
});
/* We don't use the default blog stuff
# Posts - Second to last set, match slug
Route::get('{postSlug}', 'BlogController@getView');
Route::post('{postSlug}', 'BlogController@postView');
*/
/** ------------------------------------------
* Authenticated User Routes
* ------------------------------------------
*/
Route::group(array('before' => 'auth'), function () {
# Resource route for the cloud account API crendentials