【发布时间】:2019-04-06 16:12:36
【问题描述】:
我有这样的路线http://localhost:8000/admin/edit-profile/13
我的页面名称是 edit-profile.blade.php
我只想从这条路线上得到edit-profile。
任何想法如何完成这项任务?
任何帮助将不胜感激...
【问题讨论】:
我有这样的路线http://localhost:8000/admin/edit-profile/13
我的页面名称是 edit-profile.blade.php
我只想从这条路线上得到edit-profile。
任何想法如何完成这项任务?
任何帮助将不胜感激...
【问题讨论】:
You can pass the reference like this one, but still you need the id in the url either before edit or after edit depends upon your route -
public function editProfile(ModelClass $id){ //$id holds all the data as per the id
$data = $id;
return view('edit-profile',compact('data'));
}
【讨论】:
【讨论】:
你应该试试这个:
控制器
public function editProfile($id){
$rsltTest = yourModelName::find($id);
return view('edit-profile',compact('rsltTest'));
}
路线
Route::get('edit-profile/{id}', 'ProfileController@editProfile')->name('edit-profile');
【讨论】: