控制器返回空白数据/视图,我认为我的路线有问题。如果我删除{locale},则检索数据。当我的路线中有数据时,任何人都可以帮助正确返回数据{locale}吗?这是我的相关代码:网页.phpRoute::get('{locale}/projects/{id}/billings', 'ProjectController@showbilling') ->name('showbilling');Route::post('{locale}/projects/{id}', 'ProjectController@addbilling') ->name('addbilling');项目控制器.phppublic function showbilling($id){ $billings = Project::find($id); $locale = app()->getLocale(); return $billings; //return view('admin.addbillings', compact('billings'));}编辑:这是我的完整 web.php网页.phpRoute::get('/', function() { return redirect(app()->getLocale());});Route::group(['prefix' => '{locale}', 'where' => ['locale' => '[a-zA-Z]{2}'], 'middleware' => 'setlocale'], function () { Route::get('/', function () { return view('welcome'); })->name('main'); Auth::routes(); Route::get('/home', 'HomeController@index')->name('home'); //Customers Route::get('/customers', 'CustomerController@showcust')->name('customers'); Route::post('/sendcust', 'CustomerController@sendcust')->name('sendcust'); //Items Route::get('/items', 'ItemController@showitems')->name('items'); Route::post('/senditem', 'ItemController@senditem')->name('senditem'); //Projects Route::get('/projects', 'ProjectController@showprojects')->name('projects'); Route::post('/sendproj', 'ProjectController@sendproj')->name('sendproj'); //ProjectBillings Route::get('/projects/{id}/billings', 'ProjectController@showbilling')->name('showbilling'); Route::post('/projects/{id}', 'ProjectController@addbilling')->name('addbilling'); });
1 回答
- 1 回答
- 0 关注
- 168 浏览
添加回答
举报
0/150
提交
取消