0
如何从控制器1获取参数到控制器2.我的控制器1是返回视图,控制器2是角度的。我怎样才能从控制器1到控制器2获得分支机构?如何在同一控制器中从一个功能获取参数到另一个功能laravel
我使用此代码为我的路线:
Route::get('srccond/{branchid}', '[email protected]_view');
Route::get('/api/v1/srcs/', '[email protected]');
我为srccond route
<a href="{{url('srccond/'.$value->branch_id)}}" class="brnch_clk"
data-branch="{{$value->branch_id}}">{{$value->branch_name}}</a>
我控制器
public function return_view($branchid){
$data_branch_dep = DB::table('branch_tbl')->orderby('branch_name')->get();
$data_dep = DB::table('dep_tbl')->orderby('dep_name')->get();
return view('frontend.staffinfoajax', compact('data_branch_dep', 'data_dep'));
}
public function searchcond(){
return DB::table('studentinfo')->where('branchID', '=', $branchid)->get();
}
我怎样才能从$branchid
到function return_view
鉴于function searchcond
?
我在哪里可以把这个代码? –
好吧,你把它放在'$ branchid'中的第二个函数 – Gardezi
有错误:应用程序\ Http \ Controllers \ ShowstaffController :: return_view()缺少参数1,在C:\ xampp \ htdocs \ intranet \ app \ Http中调用\ Controllers \ ShowstaffController.php,并定义了 –