Passing multiple parameters to controller in Laravel 5

后端 未结 4 1379
有刺的猬
有刺的猬 2020-12-10 01:03

In my application, a user has the ability to remind another user about an event invitation. To do that, I need to pass both the IDs of the event, and of the user to be invit

4条回答
  •  再見小時候
    2020-12-10 01:48

    Route :

    Route::get('warden/building/{buildingId}/employee/{employeeId}',[
        'uses'=>'WardenController@deleteWarden',
        'as'=>'delete-warden'
    ]);
    

    View :

    
    

    Controller:

    public function deleteWarden($buildingId,$employeeId){
        $building = Building::find($buildingId);
        $building->employees()->detach($employeeId);
        return redirect('warden/assign/'.$buildingId)->with('message','Warden Detached successfully');
    
    }
    

提交回复
热议问题