switch case in laravel controller

Solutions on MaxInterview for switch case in laravel controller by the best coders in the world

showing results for - "switch case in laravel controller"
Bryden
11 Jan 2017
1you can use $request->get('submitbutton') in your method :
2
3for example :
4public function setGroupApprovel(Request $request)
5{
6    switch ($request->get('submitbutton')) {
7        case 'save':
8            $groups_create_subscription = new GroupSubscription();
9            $groups_create_subscription->idgroups = $request->input('idgroup');
10            $groups_create_subscription->subscriber = $request->input('iduser');
11            $groups_create_subscription->save();
12            break;
13        case 'nosave':
14
15            $groups_request = new GroupRequest();
16            $groups_request->iduser::find($request->iduser);
17            $groups_request->request_active = 0;
18            $groups_request->save;
19            break;
20    }
21}
22
23and i use :
24<input id='submit' class="btn btn-default" type='submit' name = 'submitbutton' value = 'save'>
25<input id='submit' class="btn btn-default" type='submit' name = 'submitbutton' value = 'nosave'>
26
27instead of :
28{!! Form::submit('Yes',['class' => 'btn btn-default', 'name' => 'submitbutton', 'value' => 'save'])!!}
29{!! Form::submit('No',['class' => 'btn btn-default', 'name' => 'submitbutton', 'value' => 'nosave'])!!}
queries leading to this page
laravel com switch caseswitch case better laravel controllerblade switch laravellaravel case switchlaravel switch case controllerlaravel blade switch caseswitch laravel returnswitch case blade laravelphp switch laravelswitch button laravelrender div in switch case laravellaravel case in controllerswitch case in laravel controllerswirch case laravel controllerusing switch in laravellaravel switch in controllerswitch case inside switch case in laravel controllerswitch laravel controllerlaravel switch case in controllerswitch laravelswitch case laravel bladeblade switch caseswitch case laravelswitch example laravellaravel switch caselaravel 8 switch caselaravel switch functionlaravel 40switchlaravel controller switch caselaravel switch case display divlaravel switchswitch laravel 8 exampleswitch case in controller laravel 8switch in laravellaravel 7 switch functionhow to use switch statement in laravellaravel switch in bladeswitch case php laravelswitch case laravel controller example for gradesswitch case laravel controllerswitch in laravel bladeswitch in blade laravelswitch in laravel controllerswitch case condition in laravel controllerlaravel 8 blade switch caseswitch else in laravelswitch case in laravellaravel switch view case in controllerswitch case in blade laravelswitch case bigger laravel controller 40switch laravel bladecase name controller laravelswitch case in php laravel 40switch laravelswitch case in laravel bladecase switch laravellaravel blade switch caesblade switch case laravellaravel switch controllerlaravel blade switchswitch statement laravelswitch laravel status switch laravelswitch case in laravel controller