dimanche 27 août 2017

How to get parameter from one function to another function in the same controller laravel

How can i get parameter from controller 1 to controller 2. My controller 1 is return view and controller 2 is angular. How can i get branchid from controller 1 to controller 2

i use this code for my route:

Route::get('srccond/{branchid}', 'ShowstaffController@return_view');
Route::get('/api/v1/srcs/', 'ShowstaffController@searchcond');

my view for srccond route

<a href="" class="brnch_clk" 
data-branch=""></a>

My controller

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();
    }

How can i get $branchid from function return_view to function searchcond



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire