本文整理汇总了PHP中Route::Resource方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::Resource方法的具体用法?PHP Route::Resource怎么用?PHP Route::Resource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Route
的用法示例。
在下文中一共展示了Route::Resource方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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::get('/', function () {
return View::make('hello');
});
Route::Resource('notes', 'notesController');
示例2: function
| 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::get('/', function () {
return view('index');
});
/*
|--------------------------------------------------------------------------
| 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.
|
*/
Route::group(['prefix' => 'api'], function () {
Route::resource('authenticate', 'AuthenticateController', ['only' => ['index']]);
Route::post('authenticate', 'AuthenticateController@authenticate');
});
/*
Route::group(array('before' => 'auth'), function()
{*/
Route::Resource('/api/v1/user/', 'UserController');
Route::Resource('/api/v1/information', 'InformationController');
Route::Resource('/api/v1/registration', 'RegistrationController');
Route::get('/api/v1/pdf', 'PdfController@index');
/*
});
*/
示例3: 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::get('/', function () {
return Redirect::to('service');
});
//Route::get('/', array('as' => 'home', 'uses' => 'HomeController@index'));
Route::Resource('service', 'App\\Controllers\\ServiceController');
Route::Resource('pet', 'App\\Controllers\\PetController');
Route::post('ajax', 'App\\Controllers\\AjaxController@index');
示例4: function
*/
/*
|--------------------------------------------------------------------------
| 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.
|
*/
Route::group(['middleware' => ['web', 'throttle:30']], function () {
Route::get('/', 'BlogController@main');
Route::get('/post/{slug}', 'BlogController@showPost');
Route::get('/archive', 'ArchiveController@getArchive');
Route::get('/archive/{id}', 'ArchiveController@category');
Route::get('/date/{year}/{month}', 'ArchiveController@date');
Route::get('/about/', 'AboutController@index');
Route::auth();
});
Route::group(['middleware' => ['web', 'auth']], function () {
Route::get('/admin', 'HomeController@index');
Route::Resource('/admin/post', 'PostController');
Route::Resource('/admin/archive', 'ArchiveController');
Route::post('/upload', 'PostController@upload');
Route::get('/admin/upload', 'UploadController@index');
Route::post('/admin/upload/file', 'UploadController@uploadFile');
Route::delete('/admin/upload/file', 'UploadController@deleteFile');
Route::post('/admin/upload/folder', 'UploadController@createFolder');
Route::delete('/admin/upload/folder', 'UploadController@deleteFolder');
});
示例5: function
Route::get('/teste', ['as'=>'teste',function(){
return [
'success'=>true,
'mensagem'=>'Usuário tem acesso a rota teste '
];
}]);
});
*/
Route::group(['middleware' => 'web'], function () {
Route::auth();
// Route::get('/home', 'HomeController@index');
});
Route::group(['middleware' => 'cors'], function () {
/*$router->get('api', 'ApiController@index');*/
Route::post('oauth/access_token', function () {
return Response::json(Authorizer::issueAccessToken());
});
Route::group(['prefix' => 'api', 'as' => 'api.', 'middleware' => 'oauth'], function () {
Route::group(['prefix' => 'client', 'as' => 'client.', 'middleware' => 'oauth.checkrole:client'], function () {
Route::Resource('order', 'Api\\Client\\ClientCheckoutController', ['except' => ['create', 'edit', 'destroy']]);
Route::get('products', 'Api\\Client\\ClientProductController@index');
});
Route::group(['prefix' => 'deliveryman', 'as' => 'deliveryman.', 'middleware' => 'oauth.checkrole:deliveryman'], function () {
Route::Resource('order', 'Api\\Deliveryman\\DeliverymanCheckoutController', ['except' => ['create', 'edit', 'destroy', 'store']]);
Route::patch('order/{id}/update-status', ['uses' => 'Api\\Deliveryman\\DeliverymanCheckoutController@updateStatus', 'as' => 'order.update_status']);
});
Route::get('cupom/{code}', 'Api\\CupomController@show');
Route::get('authenticated', 'Api\\UserController@authenticated');
});
});
示例6: array
<?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::Resource('/', 'App\\Controllers\\UserRegController');
Route::get('user/{userId}/downloadHere', array('as' => 'user.downloadHere', 'uses' => 'App\\Controllers\\UserRegController@downloadFromHere'));
Route::get('pdf/{userId}', array('as' => 'downloadPDF', 'uses' => 'App\\Controllers\\UserRegController@generatePDF'));
示例7:
Route::resource('clasificadoscategorias', 'ClasificadosCategoriaController');
Route::get('clasifsolicpremium', 'ClasificadosController@solicpremium');
//SOLICITUDES PARA CLASIFICADOS PREMIUM
Route::get('aceptarsolicpremium', 'ClasificadosController@aceptarsolicpremium');
// APRUEBA LOS PRIMIUM
//EVENTOS
Route::resource('eventos', 'eventosController');
Route::resource('eventos/publicar', 'eventosController');
Route::get('eventos/editar/{id}', 'eventosController@edit');
Route::Resource('eventos/guardarEdicion', 'eventosController');
Route::get('eventos/borrar/{id}', 'eventosController@destroy');
//BANNERS
Route::resource('banners', 'bannersController');
Route::resource('banners/publicar', 'bannersController');
Route::get('banners/editar/{id}', 'bannersController@edit');
Route::Resource('banners/guardarEdicion', 'bannersController');
Route::get('banners/borrar/{id}', 'bannersController@destroy');
//USUARIOS
Route::resource('usuarioadmin', 'UsuariosAdminController');
Route::get('adminusuarioedit', 'UsuariosAdminController@editarAdmin');
Route::resource('usuarios', 'UsuariosNormalesController');
//COBROS
Route::resource('cobros', 'CobrosController');
Route::resource('cobrostipo', 'CobrosTipoController');
Route::resource('cobroshistorial', 'CobrosHistorialController');
Route::post('elimtodoscobrosh', 'CobrosHistorialController@eliminarTodos');
//PAGOS PENDIENTES
Route::resource('pagospendientes', 'PagosPendController');
Route::post('pagospendaceptarcobro', 'PagosPendDatosController@aceptarcobro');
});
// ===============================================
示例8: 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.
|
*/
Route::get('/', function () {
return view('welcome');
});
//
//Route::get('admin', function(){
// return view('templates/admin_template');
//});
//Route::get('admin', 'SessionsController@login');
Route::get('register', 'RegistrationController@register');
Route::post('register', 'RegistrationController@postRegister');
Route::get('register/confirm/{token}', 'RegistrationController@confirmEmail');
Route::get('login', 'SessionsController@login');
Route::post('login', 'SessionsController@postLogin');
Route::get('logout', 'SessionsController@logout');
//Route::get('dashboard', ['middleware' => 'auth', 'uses' => ''], 'admin');
//Route::get('admin', ['middleware' => 'auth', function() {
// return view('templates/admin_template');
//}]);
Route::group(['prefix' => 'admin', 'namespace' => 'Admin', 'middleware' => 'auth'], function () {
Route::get('/', ['as' => 'dashboard', 'uses' => function () {
return view('templates/admin_template');
}]);
Route::Resource('profile', 'ProfileController@index');
});
示例9: function
<?php
/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in 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::get('/', 'HomeController@index');
Route::get('helo', 'HeloController@helo');
Route::get('names', function () {
return array(1 => "John", 2 => "Mary", 3 => "Steven");
});
Route::Resource('names', 'NamesController');
示例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 controller to call when that URI is requested.
|
*/
Route::get('/', function () {
return view('welcome');
});
Route::group(['prefix' => 'v1'], function () {
Route::Resource('fondas', 'FondaController');
//Route::Resource('users', 'UserController');
});
示例11: function
<?php
Route::get('/', function () {
return view('pages.home');
});
Route::Resource('flyers', 'FlyersController');
示例12: 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::get('/', function () {
return view('welcome');
});
Route::Group(array('prefix' => 'api/v0.1'), function () {
Route::Resource('persona', 'personaController', ['only' => ['index', 'store', 'update', 'destroy', 'show']]);
Route::Resource('post', 'postController', ['only' => ['index', 'store', 'update', 'destroy', 'show']]);
Route::Resource('comentario', 'comentarioController', ['only' => ['index', 'store', 'update', 'destroy', 'show']]);
});
示例13: 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::get('', ['as' => 'tasks.index', function () {
return view('welcome');
}]);
Route::group(['prefix', 'middleware' => 'auth'], function () {
Route::get('/', ['as' => 'admin.index', function () {
return view('welcome');
}]);
Route::Resource('tasks', 'TasksController');
Route::get('tasks/{id}/destroy', ['uses' => 'TasksController@destroy', 'as' => 'tasks.destroy']);
Route::Resource('settings', 'SettingsController');
Route::get('settings/{id}/destroy', ['uses' => 'TasksController@destroy', 'as' => 'tasks.destroy']);
});
Route::get('auth/login', ['uses' => 'Auth\\AuthController@getLogin', 'as' => 'auth.login']);
Route::post('auth/login', ['uses' => 'Auth\\AuthController@postLogin', 'as' => 'auth.login']);
Route::get('auth/logout', ['uses' => 'Auth\\AuthController@getLogout', 'as' => 'auth.logout']);
// Registration routes...
Route::post('auth/register', ['uses' => 'Auth\\AuthController@postRegister', 'as' => 'auth.register']);
Route::get('auth/register', ['uses' => 'Auth\\AuthController@getRegister', 'as' => 'auth.register']);