本文整理汇总了PHP中Route::resources方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::resources方法的具体用法?PHP Route::resources怎么用?PHP Route::resources使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Route
的用法示例。
在下文中一共展示了Route::resources方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
#Installation script Routes
Route::group(array('prefix' => 'install', 'before' => 'install'), function () {
Route::get('/', 'InstallController@index');
Route::get('/database', 'InstallController@getDatabase');
Route::post('/database', 'InstallController@postDatabase');
Route::get('/user', 'InstallController@getUser');
Route::post('/user', 'InstallController@postUser');
});
Route::group(['middleware' => 'install'], function () {
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
Route::group(['middleware' => 'auth'], function () {
#home controller
Route::get('/', 'HomeController@index');
Route::get('home', 'HomeController@index');
#Resources Routes
Route::resources(['users' => 'UsersController', 'clients' => 'ClientsController', 'invoices' => 'InvoicesController', 'products' => 'ProductsController', 'expenses' => 'ExpensesController', 'estimates' => 'EstimatesController', 'payments' => 'PaymentsController', 'reports' => 'ReportsController']);
#Grouped Routes
Route::group(array('prefix' => 'settings'), function () {
Route::resource('company', 'SettingsController', array('only' => array('index', 'store', 'update')));
Route::resource('invoice', 'InvoiceSettingsController', array('only' => array('index', 'store', 'update')));
Route::resource('tax', 'TaxSettingsController');
Route::resource('templates', 'TemplatesController', array('only' => array('index', 'show', 'store', 'update')));
Route::resource('number', 'NumberSettingsController', array('only' => array('index', 'store', 'update')));
Route::resource('payment', 'PaymentMethodsController', array('except' => array('show', 'create')));
Route::resource('currency', 'CurrencyController', array('except' => array('show', 'create')));
});
# estimates resource
Route::group(array('prefix' => 'estimates'), function () {
Route::post('deleteItem', 'EstimatesController@deleteItem');
Route::get('pdf/{id}', 'EstimatesController@estimatePdf');
Route::get('send/{id}', 'EstimatesController@send');
示例2: env
|
| 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::group(['namespace' => 'Frontend', 'domain' => env('HTTP_DOMAIN')], function () {
Route::get('/', function () {
return view('welcome');
});
Route::controller('auth', 'Auth\\AuthController');
Route::controller('password', 'Auth\\PasswordController');
if (file_exists(app_path('Http/Controllers/Frontend/TestController.php'))) {
Route::controller('test', 'TestController');
}
});
Route::group(['namespace' => 'Backend', 'domain' => env('ADMIN_DOMAIN')], function () {
Route::controller('auth', 'Auth\\AuthController');
Route::controller('password', 'Auth\\PasswordController');
Route::group(['middleware' => 'admin.auth'], function () {
Route::get('/', 'DashboardController@getIndex');
Route::controller('dash', 'DashboardController');
// Route::controller('goods', 'GoodsController');
Route::resources(['category' => 'CategoryController', 'goods' => 'GoodsController', 'brand' => 'BrandController', 'goodstype' => 'GoodstypeController']);
// Route::controller('brand', 'BrandController');
// Route::controller('goodstype', 'GoodstypeController');
});
if (file_exists(app_path('Http/Controllers/Backend/TestController.php'))) {
Route::controller('test', 'TestController');
}
});
示例3: bcrypt
$user = \App\User::find(3);
$user->password = bcrypt('12345678');
$user->save();
});
Route::group(['middleware' => 'role:administrador'], function () {
/*
* Delete Routes
*/
Route::post('usuario/{id}/delete', ['as' => 'usuario.destroy', 'uses' => 'UserController@destroy']);
Route::post('rol/{id}/delete', ['as' => 'rol.destroy', 'uses' => 'RoleController@destroy']);
Route::post('permiso/{id}/delete', ['as' => 'permiso.destroy', 'uses' => 'PermissionController@destroy']);
Route::post('tipo_pregunta/{id}/delete', ['as' => 'tipo_pregunta.destroy', 'uses' => 'TipoPreguntaController@destroy']);
/*
* Resources
*/
Route::resources(['usuario' => 'UserController', 'rol' => 'RoleController', 'permiso' => 'PermissionController', 'cliente' => 'ClienteController', 'pregunta_secreta' => 'PreguntaSecretaController', 'tipo_pregunta' => 'TipoPreguntaController', 'asociado' => 'AsociadoController']);
/*
* JSON POST
*/
Route::post('usuarios', 'UserController@postJsonList');
Route::post('roles', 'RoleController@postJsonList');
Route::post('permisos', 'PermissionController@postJsonList');
Route::post('clientes', 'ClienteController@postJsonList');
Route::post('obtener_tipo_pago/{id}', 'TipoPagoController@getJsonTipoPago');
Route::post('preguntas', 'PreguntaSecretaController@getJsonPregunta');
Route::post('tipos_preguntas', 'TipoPreguntaController@getJsonList');
Route::post('asociados/{id}', 'AsociadoController@getJsonListByCliente');
/*
* OTHERS
*/
Route::get('rol/{id}/attachperms', 'RoleController@getAttachPerms');
示例4: function
Route::get('user/settings', ['as' => 'user.settings', 'uses' => 'UserController@getSettings']);
Route::post('user/settings', 'UserController@postSettings');
Route::get('user/favorites', ['as' => 'user.favorites', 'uses' => 'UserController@getFavorites']);
Route::post('user/avatar', ['as' => 'user.avatar', 'uses' => 'UserController@postAvatar']);
# Trick creation route
Route::get('user/tricks/new', ['as' => 'tricks.new', 'uses' => 'UserTricksController@getNew']);
Route::post('user/tricks/new', 'UserTricksController@postNew');
# Trick editing route
Route::get('user/tricks/{trick_slug}', ['as' => 'tricks.edit', 'uses' => 'UserTricksController@getEdit']);
Route::post('user/tricks/{trick_slug}', 'UserTricksController@postEdit');
# Trick delete route
Route::get('user/tricks/{trick_slug}/delete', ['as' => 'tricks.delete', 'uses' => 'UserTricksController@getDelete']);
# Feed routes
Route::get('feed', ['as' => 'feed.atom', 'uses' => 'FeedsController@getAtom']);
Route::get('feed.atom', ['uses' => 'FeedsController@getAtom']);
Route::get('feed.xml', ['as' => 'feed.rss', 'uses' => 'FeedsController@getRss']);
# This route will match the user by username to display their public profile
# (if we want people to see who favorites and who posts what)
Route::get('{user}', ['as' => 'user.profile', 'uses' => 'UserController@getPublic']);
/*
* Admin
*/
$admin = ['prefix' => 'admin', 'namespace' => 'Admin', 'middleware' => 'admin'];
Route::group($admin, function () {
Route::controller('auth', 'AuthController');
Route::resources(['/' => 'HomeController', 'links' => 'LinkController']);
Route::controller('users', 'UserController');
Route::controller('settings', 'SettingController');
Route::any('upload/ueditor', 'UploadController@ueditor');
Route::post('upload/image', 'UploadController@postImage');
});
示例5:
<?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('/', 'DashboardController@home');
Route::post('upload/respondents', 'RespondentController@upload');
Route::controller('toot/smsquery', '\\smsquery\\RouteController');
//Route::controller('/ti/{ti_id?}/', function($ti_id)
//{
// dd('\\' . $ti->toot->namespace . '\RouteController');
// $ti = \nable\TootInstance::find($ti_id);
//
// return '\\' . $ti->toot->namespace . '\RouteController';
//});
Route::resources(['organization' => 'OrganizationController', 'project' => 'ProjectController', 'topic' => 'TopicController', 'question' => 'QuestionController', 'response' => 'ResponseController', 'respondent' => 'RespondentController']);
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
示例6: function
<?php
Route::group(['middleware' => ['web']], function () {
Route::get('/', ['as' => 'home', 'uses' => 'HomeController@index']);
Route::resources(['/group' => 'Group\\GroupController', '/group.program' => 'Group\\ProgramController']);
Route::auth();
});
示例7: function
Route::group(['prefix' => 'data', 'namespace' => 'Data'], function () {
Route::group(['prefix' => 'tambahan', 'namespace' => 'Tambahan'], function () {
Route::resources(['agama' => 'AgamaController', 'akses_inet' => 'AksesInternetController', 'jenis_kelamin' => 'JenisKelaminController', 'suplai_air' => 'SuplaiAirController', 'sumber_listrik' => 'SumberListrikController']);
});
Route::group(['prefix' => 'program', 'namespace' => 'Program'], function () {
Route::resources(['data_kebutuhan_khusus' => 'DataKebutuhanKhususController', 'data_layanan_khusus' => 'DataLayananKhususController']);
});
Route::group(['prefix' => 'administrasi/sekolah', 'namespace' => 'Administrasi\\Sekolah'], function () {
Route::resources(['status_sekolah' => 'StatusSekolahController', 'sertifikat_iso' => 'SertifikatIsoController', 'bentuk_pendidikan' => 'BentukPendidikanController', 'status_kepemilikan' => 'StatusKepemilikanController']);
});
Route::group(['prefix' => 'akreditasi', 'namespace' => 'Akreditasi'], function () {
Route::resources(['lembaga_akreditasi' => 'LembagaController', 'nilai_akreditasi' => 'NilaiController']);
});
Route::group(['prefix' => 'region', 'namespace' => 'Region'], function () {
Route::resources(['provinsi' => 'ProvinsiController', 'kabupaten' => 'KabupatenController', 'kecamatan' => 'KecamatanController', 'kelurahan' => 'KelurahanController', 'kategori_wilayah' => 'KategoriWilayahController']);
});
Route::group(['prefix' => 'penyelenggaraan', 'namespace' => 'Penyelenggaraan'], function () {
Route::resources(['semester' => 'SemesterController', 'tahun_ajaran' => 'TahunAjaranController', 'waktu_penyelenggaraan' => 'WaktuPenyelenggaraanController']);
});
});
Route::resource('yayasan', 'YayasanController');
Route::group(['prefix' => 'sekolah', 'namespace' => 'Sekolah'], function () {
Route::group(['prefix' => 'program', 'namespace' => 'Program'], function () {
Route::resources(['inkuisi' => 'InkuisiController', 'layanan_khusus' => 'LayananKhususController']);
});
Route::get('massasigment', ['as' => 'massasigment', 'uses' => function () {
return "you found me :V";
}]);
Route::resources(['sekolah' => 'SekolahController', 'akreditasi' => 'AkreditasiController', 'rekening' => 'RekeningController', 'perizinan' => 'PerizinanController', 'lokasi_sekolah' => 'LokasiSekolahController', 'periodik' => 'PeriodikController', 'rekening' => 'RekeningController', 'sertifikat_iso' => 'SertifikasiIsoController', 'sanitasi' => 'SanitasiController', 'sertifikasi' => 'SertifikasiIsoController', 'siswa' => 'SiswaController', 'tambahan' => 'TambahanController']);
});
});
示例8:
| This route will tell the Router which controller/method to use if those
| provided in the URL cannot be matched to a valid route.
|
| $route['translate_uri_dashes'] = FALSE;
|
| This is not exactly a route, but allows you to automatically route
| controller and method names that contain dashes. '-' isn't a valid
| class or method name character, so it requires translation.
| When you set this option to TRUE, it will replace ALL dashes in the
| controller and method URI segments.
|
| Examples: my-controller/index -> my_controller/index
| my-controller/my-method -> my_controller/my_method
*/
require_once 'api_route.php';
/**
* get : usercontroller -> index
* get : usercontroller/1 -> show
* get : usercontroller/1/edit -> edit
* post: usercontroller -> store
* put/patch : usercontroller -> update
* delete: usercontroller/1 -> delete
*/
Route::resources('UserController');
// open source route
$route = Route::map();
eval(decode_api($wap_api));
// Format API Routes
$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
示例9: function
<?php
Route::model('user', 'App\\User');
Route::model('post', 'App\\Post');
Route::controllers(['auth' => 'AuthController', 'checkout' => 'CheckoutController', 'schedule' => 'ScheduleController', 'shorten' => 'ShortenController']);
Route::get('me', 'UserController@edit');
Route::post('me', 'UserController@store');
Route::patch('me', 'UserController@update');
Route::get('user/{user}', 'UserController@show');
Route::group(['prefix' => 'api/v1', 'namespace' => 'API'], function () {
Route::controllers(['trade' => 'TradeController']);
Route::resources(['post' => 'PostController']);
Route::post('post/{post}/reschedule', 'PostController@reschedule');
});
Route::get('/{hash}', 'ShortenController@handleShortcode');
Route::get('/', ['as' => 'home', 'uses' => 'SiteController@getIndex']);
Route::controller('/', 'SiteController');
示例10: function
});
Route::resources(['provinsi' => 'ProvinsiController', 'kabupaten' => 'KabupatenController', 'kecamatan' => 'KecamatanController', 'desa' => 'DesaController']);
Route::get('get/{region}/{id}', ['as' => 'getRegion', 'uses' => function ($r, $id) {
$data = [];
if ($r == 'kabupaten') {
foreach (\App\Kabupaten::where('provinsi_id', $id)->get() as $list) {
$data = array_merge_recursive($data, [['id' => $list->id, 'text' => $list->label]]);
}
}
if ($r == 'kecamatan') {
foreach (\App\Kecamatan::where('kabupaten_id', $id)->get() as $list) {
$data = array_merge_recursive($data, [['id' => $list->id, 'text' => $list->label]]);
}
}
if ($r == 'desa') {
foreach (\App\Desa::where('kecamatan_id', $id)->get() as $list) {
$data = array_merge_recursive($data, [['id' => $list->id, 'text' => $list->label]]);
}
}
return $data;
}]);
});
});
Route::group(['prefix' => 'admin/kecamatan', 'middleware' => 'UAC:kecamatan', 'namespace' => 'Admin\\Kecamatan'], function () {
Route::get('/', ['as' => 'admin.kecamatan.landing', 'uses' => function () {
return view('admin_template');
}]);
Route::get('get_bantuan', ['as' => 'getBantuan', 'uses' => 'PenerimaBantuanController@getBantuan']);
Route::get('get_kriteria', ['as' => 'getKI', 'uses' => 'PenerimaBantuanController@getKI']);
Route::resources(['penduduk' => 'PendudukController', 'penerima' => 'PenerimaBantuanController', 'generate' => 'GeneratorController']);
});
示例11: function
Route::get('admin/logout', 'Auth\\AuthController@getLogout');
//Public authentication routes
Route::get('/login', 'PublicAuthController@getLogin');
Route::post('/login', 'PublicAuthController@postLogin');
Route::get('/logout', 'PublicAuthController@getLogout');
Route::group(['prefix' => 'admin', 'middleware' => ['auth', 'backend_access']], function () {
Route::get('/', 'AdminPagesController@home');
Route::get('/mail', 'AdminPagesController@sendMail');
/* Edit password */
Route::get('/director/{id}/edit/password', 'DirectorController@getEditPassword');
Route::post('/director/{id}/edit/password', 'DirectorController@postEditPassword');
Route::get('/administrador/{id}/edit/password', 'AdministradorController@getEditPassword');
Route::post('/administrador/{id}/edit/password', 'AdministradorController@postEditPassword');
Route::get('/alumno/{id}/edit/password', 'AlumnoController@getEditPassword');
Route::post('/alumno/{id}/edit/password', 'AlumnoController@postEditPassword');
/* RESTful */
Route::resources(['administrador' => 'AdministradorController', 'director' => 'DirectorController', 'maestro' => 'MaestroController', 'escuela' => 'EscuelaController', 'estado' => 'EstadoController', 'tabla' => 'TablaController', 'estatus' => 'EstatusController', 'alumno' => 'AlumnoController']);
});
Route::group(['prefix' => '/', 'middleware' => 'public_auth'], function () {
Route::get('/', 'PublicPagesController@home');
Route::get('grupos', 'PublicPagesController@gruposJson');
Route::get('grupo/{grupo_id}/alumnos', 'AlumnoController@alumnoByGrupo');
Route::get('/escuelas', 'PublicPagesController@escuelasJson');
Route::get('/alumno/{alumno_id}/tareas', 'AlumnoController@getTareasAlumno');
Route::get('alumno/{alumno_id}/tarea/{tarea_id}/calificar', 'TareaController@getCalificarTarea');
Route::post('/periodos', 'PeriodoController@periodosJson');
Route::post('grupo/alumnos', 'AlumnoController@postAlumnoByGrupo');
Route::post('alumno/tareas', 'AlumnoController@postTareasAlumno');
Route::post('tarea/calificar', 'TareaController@postCalificarTarea');
Route::resources(['periodo' => 'PeriodoController']);
});
示例12: function
<?php
Route::get('/', function () {
return view('welcome');
});
// public
Route::group(['middleware' => 'web'], function () {
Route::auth();
Route::get('/home', 'HomeController@index');
});
// admin
Route::group(['middleware' => ['web', 'auth', 'admin'], 'namespace' => 'Admin', 'prefix' => 'admin'], function () {
// base view
Route::get('/', 'AdminController@index');
// actions
Route::resources(['users' => 'UsersController']);
Route::resources(['roles' => 'RolesController']);
Route::resources(['documents' => 'DocumentsController']);
Route::get('permissions', 'PermissionsController@index');
});
示例13:
<?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::resources('customer', 'CustomerController');
示例14: 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.
|
*/
/*
|--------------------------------------------------------------------------
| 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'], function () {
Route::auth();
Route::get('/', 'HomeController@index');
Route::resources(['/course' => 'CourseController']);
});
示例15: function
Route::controllers(['/vk-friend' => 'Pages\\FriendsController', '/wallpaper' => 'Wallpaper\\WallpaperController', '/bot_telegram' => 'CrossFit\\MainController']);
// ТЕСТ создание страницы слайдоов
Route::get('/slide', function () {
return view('pages.slides.content');
})->name('slide');
/* * * * * * * * * * * * *
| Выдача шаблонов для View Angular.JS
*/
Route::get('/template/{name}', function ($name) {
return View::make('angular-pages.' . $name);
});
Route::get('/auth', function () {
return view('auth.index');
})->name('auth');
// Authentication routes...
Route::get('/auth/login', 'Auth\\AuthController@getLogin')->name('login');
Route::post('/auth/login', 'Auth\\AuthController@postLogin');
Route::get('/auth/logout', 'Auth\\AuthController@getLogout')->name('logout');
//* Registration routes...
Route::get('/auth/register', 'Auth\\AuthController@getRegister')->name('register');
Route::post('/auth/register', 'Auth\\AuthController@postRegister');
// */
Route::get('/social_login/{provider}', 'Auth\\SocialController@login')->name('social_login');
Route::get('/social_login/callback/{provider}', 'Auth\\SocialController@callback');
// Social login
Route::group(['namespace' => 'Admin', 'prefix' => 'admin', 'middleware' => 'admin', 'as' => 'admin_page'], function () {
// admin route
Route::resources(['/glossary_req' => 'GlossaryReqController', '/glossary' => 'GlossaryController']);
Route::controller('/', 'DashbordController');
});
//