本文整理汇总了PHP中Route::pattern方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::pattern方法的具体用法?PHP Route::pattern怎么用?PHP Route::pattern使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Route
的用法示例。
在下文中一共展示了Route::pattern方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispatch
/**
* @param Route $route
*
* @return mixed
*/
public function dispatch(Route $route)
{
$handler = $route->handler();
if (!is_callable($handler) && $this->resolver !== null) {
$handler = call_user_func($this->resolver, $handler);
}
if (is_callable($handler)) {
return call_user_func_array($handler, $route->attributes());
}
throw new \ErrorException("Target specified for '{$route->pattern()}' cannot be called");
}
示例2: 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.
|
*/
Route::pattern('id', '[0-9]+');
Route::pattern('uri_id', '[0-9]+');
Route::pattern('active', '(true|false)');
Route::pattern('hint', '(access-token|refresh-token)');
Route::pattern('scope_id', '[0-9]+');
Route::group(array("before" => "ssl"), function () {
Route::get('/', "HomeController@index");
Route::get('/discovery', "DiscoveryController@idp");
/*
* If the Claimed Identifier was not previously discovered by the Relying Party
* (the "openid.identity" in the request was "http://specs.openid.net/auth/2.0/identifier_select"
* or a different Identifier, or if the OP is sending an unsolicited positive assertion),
* the Relying Party MUST perform discovery on the Claimed Identifier in
* the response to make sure that the OP is authorized to make assertions about the Claimed Identifier.
*/
Route::get("/{identifier}", "UserController@getIdentity");
Route::get("/accounts/user/ud/{identifier}", "DiscoveryController@user")->where(array('identifier' => '[\\d\\w\\.\\#]+'));
//op endpoint url
Route::post('/accounts/openid2', 'OpenIdProviderController@endpoint');
Route::get('/accounts/openid2', 'OpenIdProviderController@endpoint');
示例3: array
<?php
Route::pattern('slug', '[A-z0-9-]+');
Route::pattern('product', '[\\d+]+');
Route::pattern('branch', '[\\d+]+');
Route::get('ebriat', array('before' => 'csrf', function () {
$home = new Andriynto\Ebri\Controllers\Home();
return $home->accessToken();
}));
Route::get('', function () {
$home = new Andriynto\Ebri\Controllers\Home();
return $home->index();
});
Route::get('login', function () {
$account = new Andriynto\Ebri\Controllers\Account();
return $account->index();
});
//After Login
Route::get('dashboard', function () {
$app = new Andriynto\Ebri\Controllers\App();
return $app->index();
});
//Setting
Route::get('settings', function () {
});
Route::get('settings/branch', array('before' => array('ebri.permission:setting.view'), function () {
$setting = new Andriynto\Ebri\Controllers\Setting();
return $setting->index();
}));
Route::get('', array('before' => array('ebri.permission:setting.view'), function () {
$setting = new Andriynto\Ebri\Controllers\Setting();
示例4: 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 Closure to execute when that URI is requested.
|
*/
if ($this->app->isLocal()) {
Route::get('/_debugbar/assets/stylesheets', ['as' => 'debugbar-css', 'uses' => '\\Barryvdh\\Debugbar\\Controllers\\AssetController@css']);
Route::get('/_debugbar/assets/javascript', ['as' => 'debugbar-js', 'uses' => '\\Barryvdh\\Debugbar\\Controllers\\AssetController@js']);
}
/**
* Model binding into route
*/
Route::model('blogcategory', 'App\\BlogCategory');
Route::model('blog', 'App\\Blog');
Route::pattern('slug', '[a-z0-9- _]+');
Route::group(array('prefix' => 'admin'), function () {
//All basic routes defined here
Route::get('login', array('as' => 'admin-login', 'uses' => 'AuthController@getLogin'));
Route::post('login', 'AuthController@postLogin');
Route::get('register', array('as' => 'admin-register', 'uses' => 'AuthController@getRegister'));
Route::post('register', 'AuthController@postRegister');
Route::get('logout', array('as' => 'logout', 'uses' => 'AuthController@getLogout'));
});
Route::group(array('prefix' => 'admin', 'middleware' => 'SentinelAdmin'), function () {
Route::get('/', array('as' => 'dashboard', 'uses' => 'ChandraController@showHome'));
# Estimate Management
Route::group(array('prefix' => 'estimates'), function () {
Route::get('/', array('as' => 'estimates', 'uses' => 'EstimateController@getEstimates'));
Route::get('create', array('as' => 'estimate/create', 'uses' => 'EstimateController@getCreate'));
Route::post('create', 'EstimateController@postCreateOrUpdate');
示例5: array
<?php
Route::pattern('id', '[a-zA-Z0-9]+');
Route::group(array('before' => array('auth', 'setup')), function () {
Route::get('surf/{type?}', 'BriskSurf\\Surf\\SurfController@getSurf')->where(array('type' => 'classic'));
Route::group(array('before' => 'crsf'), function () {
Route::post('surf/{type?}', 'BriskSurf\\Surf\\SurfController@postSurf')->where(array('type' => 'classic'));
});
});
示例6: 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.
|
*/
// Patterns
Route::pattern('id', '\\d+');
// Home
Route::get('/', function () {
return view('index');
});
// Events
Route::resource('event', 'EventController');
// Participants
Route::resource('participant', 'ParticipantController');
// Users
// Authentication routes...
Route::get('auth/login', 'Auth\\AuthController@login');
Route::post('auth/login', 'Auth\\AuthController@authenticate');
Route::get('auth/logout', 'Auth\\AuthController@logout');
// Registration routes...
Route::get('auth/register', 'Auth\\AuthController@register');
Route::post('auth/register', 'Auth\\AuthController@create');
// API
示例7: 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::resource('vehiculos', 'VehiculoController', ['only' => ['index', 'show']]);
Route::resource('fabricantes', 'FabricanteController', ['except' => ['edit', 'create']]);
Route::resource('fabricantes.vehiculos', 'FabricanteVehiculoController', ['except' => ['show', 'edit', 'create']]);
Route::pattern('inexistente', '.*');
Route::any('/{inexistente}', function () {
return response()->json(['data' => 'Solicitud incorrecta.'], 400);
});
示例8: 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 controller to call when that URI is requested.
|
*/
Route::pattern('id', '\\d+');
Route::pattern('pid', '\\d+');
Route::pattern('status', '[0-1]+');
Route::pattern('keyword', '[a-z0-9-]+');
Route::pattern('slug', '[a-zA-Z0-9-]+');
Route::pattern('nameDomain', '(www.kacana.com|kacana.com|dev.kacana.com|staging.kacana.com|www.kacana.vn|kacana.vn|dev.kacana.vn|staging.kacana.vn)');
Route::group(['prefix' => 'auth/'], function () {
// Authentication routes...
Route::get('login', array('as' => 'authGetLogin', 'uses' => 'Auth\\AuthController@getLogin'));
Route::post('login', 'Auth\\AuthController@authLogin');
Route::get('sign-out', 'Auth\\AuthController@getLogout');
// Registration routes...
Route::any('signup', array('as' => 'authGetSignup', 'uses' => 'Auth\\SignupController@signup'));
Route::any('signup/socialLoginCallback', 'Auth\\SignupController@socialLoginCallback');
Route::any('signup/facebookCallbackAllowPost', 'Auth\\SignupController@facebookCallbackAllowPost');
});
Route::any('/sitemap.xml', array('as' => 'sitemap', 'uses' => 'Client\\SitemapController@index'));
Route::any('/sitemap-tags.xml', array('as' => 'sitemap-tags.xml', 'uses' => 'Client\\SitemapController@sitemapTags'));
Route::any('/sitemap-products.xml', array('as' => 'sitemap-products.xml', 'uses' => 'Client\\SitemapController@sitemapProducts'));
Route::any('/sitemap-pages.xml', array('as' => 'sitemap-pages.xml', 'uses' => 'Client\\SitemapController@sitemapPages'));
/*********************************************************
示例9: view
*/
/*Route::get('/', function () { // '/' index
return view('home');
// return "hello world";
// return view('welcome');
});
Route::get('products', function () { //localhost:8000/products
return "je suis la liste des produits";
// return view('welcome');
});*/
use Illuminate\Http\Request;
Route::pattern('id', '[1-9][0-9]*');
Route::pattern('slug', '[a-z_-]*');
Route::pattern('id', '[1-9][0-9]*');
//proteger la page product l'id
//Route::get('contact','FrontController@showContact');
//Route::post('storeContact','FrontController@storeContact');
//Route::get('/product/foo',function(){echo "hello foo";});
//Route::get('foo',function(){echo "hello foo";});
//Route::get('post/{id}', function($id){
//return"id:$id"; });
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
示例10: function
Route::group(array('before' => 'guest', 'prefix' => ''), function () {
Route::post('signin', array('as' => 'signin', 'uses' => 'GlobalController@signin'));
Route::post('signup', array('as' => 'signup', 'uses' => 'GlobalController@signup'));
Route::get('activation', array('as' => 'activation', 'uses' => 'GlobalController@activation'));
});
/*
| Роуты, доступные для гостей и авторизованных пользователей
*/
Route::get('mod', array('before' => 'login', 'as' => 'login', 'uses' => 'GlobalController@loginPage'));
Route::get('logout', array('before' => 'auth', 'as' => 'logout', 'uses' => 'GlobalController@logout'));
#################################################################
/**
* Support Multilanguage
* @see README.md
*/
Route::pattern('lang', implode('|', array_keys(Config::get('app.locales'))))->defaults('lang', Config::get('app.locale'));
#################################################################
/***********************************************************************/
/******************** ЗАГРУЗКА РЕСУРСОВ ИЗ МОДУЛЕЙ *********************/
/***********************************************************************/
## For debug
$load_debug = 0;
## Reserved methods for return resourses of controller
$returnRoutes = "returnRoutes";
$returnActions = "returnActions";
$returnShortCodes = "returnShortCodes";
$returnExtFormElements = "returnExtFormElements";
$returnInfo = "returnInfo";
$returnMenu = "returnMenu";
## Find all controllers & load him resoures: routes, shortcodes & others...
$postfix = ".controller.php";
示例11: function
|
*/
// Demo ! loggin in as user id 3
//Auth::loginUsingId(3);
Route::get('/', 'WelcomeController@index');
Route::get('home', 'HomeController@index');
// Basic Auth
Route::get('auth/confirm/{token}', 'Auth\\AuthController@confirmEmail');
// Need to clean up
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
// Reset Email
Route::get('reset/email', 'EmailAddressController@getResetEmail');
Route::post('reset/email', 'EmailAddressController@postResetEmail');
Route::get('reset/email/confirm/{token}', 'EmailAddressController@confirmEmail');
// Patterns for Users
Route::pattern('username', '[a-zA-Z0-9_-]{3,16}');
// User
Route::get('users', 'UserController@index');
Route::get('@{username?}', 'UserController@show');
Route::get('edit/profile', 'UserController@editProfile');
Route::patch('update/profile', 'UserController@updateProfile');
Route::get('edit/description', 'UserController@editDesc');
Route::patch('update/description', 'UserController@updateDesc');
Route::get('account/email', 'UserController@set_email');
Route::get('account/password', 'UserController@set_password');
// Messages
Route::group(['prefix' => 'messages'], function () {
Route::get('/', ['as' => 'messages', 'uses' => 'MessagesController@index']);
Route::get('create', ['as' => 'messages.create', 'uses' => 'MessagesController@create']);
Route::post('/', ['as' => 'messages.store', 'uses' => 'MessagesController@store']);
Route::get('{id}', ['as' => 'messages.show', 'uses' => 'MessagesController@show']);
示例12: testRouteSetsPatternWithoutLeadingSlash
/**
* Route should set pattern, and the Route pattern should not
* retain the leading slash.
*/
public function testRouteSetsPatternWithoutLeadingSlash()
{
$route = new Route('/foo/bar', function () {
});
$this->assertEquals('foo/bar', $route->pattern());
}
示例13: function
Route::model('role', 'Role');
Route::model('hotel', 'Hotel');
Route::model('ticket', 'Ticket');
Route::model('userpic', 'Userpic');
/** ------------------------------------------
* Route constraint patterns
* ------------------------------------------
*/
Route::pattern('comment', '[0-9]+');
Route::pattern('post', '[0-9]+');
Route::pattern('hotel', '[0-9]+');
Route::pattern('ticket', '[0-9]+');
Route::pattern('user', '[0-9]+');
Route::pattern('role', '[0-9]+');
Route::pattern('token', '[0-9a-z]+');
Route::pattern('userpic', '[0-9a-z]+');
/** ------------------------------------------
* Admin Routes
* ------------------------------------------
*/
Route::group(array('prefix' => 'admin', 'before' => 'auth'), function () {
# Ticket Management
Route::get('tickets/{ticket}/show', 'AdminTicketsController@getShow');
Route::get('tickets/{ticket}/edit', 'AdminTicketsController@getEdit');
Route::post('tickets/{ticket}/edit', 'AdminTicketsController@postEdit');
Route::get('tickets/{ticket}/delete', 'AdminTicketsController@getDelete');
Route::post('tickets/{ticket}/delete', 'AdminTicketsController@postDelete');
Route::controller('tickets', 'AdminTicketsController');
# Hotel Management
Route::get('hotels/{hotel}/show', 'AdminHotelsController@getShow');
Route::get('hotels/{hotel}/edit', 'AdminHotelsController@getEdit');
示例14:
/*
|--------------------------------------------------------------------------
| 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::pattern('id', '[0-9]+');
Route::pattern('pid', '[0-9]+');
Route::pattern('status', '[0-1]+');
Route::pattern('keyword', '[a-z0-9-]+');
Route::pattern('envDomain', '(dev.|staging.|product.|)');
Route::pattern('nameDomain', '(kacana.com)');
// Authentication routes...
Route::get('auth/login', 'Auth\\AuthController@getLogin');
Route::post('auth/login', 'Auth\\AuthController@authLogin');
Route::get('auth/logout', 'Auth\\AuthController@getLogout');
// Registration routes...
Route::get('auth/register', 'Auth\\AuthController@getRegister');
Route::post('auth/register', 'Auth\\AuthController@postRegister');
Route::get('/dashboard', 'WelcomeController@index');
/*********************************************************
*
*
* ROUTE FOR ADMIN MODULE
*
*
*
示例15: get
get('/{id}', ['as' => 'index', 'uses' => 'AdminProductsController@images']);
get('create/{id}', ['as' => 'create', 'uses' => 'AdminProductsController@createImage']);
post('store/{id}', ['as' => 'store', 'uses' => 'AdminProductsController@storeImage']);
get('delete/{id}', ['as' => 'delete', 'uses' => 'AdminProductsController@deleteImage']);
});
Route::group(['prefix' => 'users', 'as' => 'users.'], function () {
get('/', ['as' => 'index', 'uses' => 'AdminUsersController@index']);
});
Route::group(['prefix' => 'orders', 'as' => 'orders.'], function () {
get('/', ['as' => 'index', 'uses' => 'AdminOrdersController@index']);
get('view/{id}', ['as' => 'view', 'uses' => 'AdminOrdersController@view']);
put('update_status/{id}', ['as' => 'update_status', 'uses' => 'AdminOrdersController@updateStatus']);
});
});
Route::group(['prefix' => '/', 'as' => 'store.'], function () {
Route::pattern('qtd', '[0-9]+');
Route::get('home', ['as' => 'index', 'uses' => 'StoreController@index']);
Route::get('/', ['as' => 'index', 'uses' => 'StoreController@index']);
Route::get('category/{id}', ['as' => 'category', 'uses' => 'StoreController@category']);
Route::get('product/{id}', ['as' => 'product', 'uses' => 'StoreController@product']);
Route::get('tag/{id}', ['as' => 'tag', 'uses' => 'StoreController@tag']);
Route::get('cart', ['as' => 'cart', 'uses' => 'CartController@index']);
Route::get('cart/add/{id}', ['as' => 'cart.add', 'uses' => 'CartController@add']);
Route::get('cart/delete/{id}', ['as' => 'cart.delete', 'uses' => 'CartController@delete']);
Route::put('cart/update/{id}', ['as' => 'cart.update', 'uses' => 'CartController@update']);
Route::get('cart/clean', ['as' => 'cart.clean', 'uses' => 'CartController@cleanCart']);
Route::get('pagseguro/retorno', ['as' => 'pagseguro.retorno', 'uses' => 'CheckoutController@retornoPagSeguro']);
//rotas com autenticacao
Route::group(['middleware' => 'auth'], function () {
Route::get('checkout/place_order', ['as' => 'checkout.place', 'uses' => 'CheckoutController@place']);
Route::get('account/orders', ['as' => 'account.orders', 'uses' => 'AccountController@orders']);