blade switch
@switch($i)
@case(1)
First case...
@break
@case(2)
Second case...
@break
@default
Default case...
@endswitch
blade switch
@switch($i)
@case(1)
First case...
@break
@case(2)
Second case...
@break
@default
Default case...
@endswitch
switch case in laravel controller
you can use $request->get('submitbutton') in your method :
for example :
public function setGroupApprovel(Request $request)
{
switch ($request->get('submitbutton')) {
case 'save':
$groups_create_subscription = new GroupSubscription();
$groups_create_subscription->idgroups = $request->input('idgroup');
$groups_create_subscription->subscriber = $request->input('iduser');
$groups_create_subscription->save();
break;
case 'nosave':
$groups_request = new GroupRequest();
$groups_request->iduser::find($request->iduser);
$groups_request->request_active = 0;
$groups_request->save;
break;
}
}
and i use :
<input id='submit' class="btn btn-default" type='submit' name = 'submitbutton' value = 'save'>
<input id='submit' class="btn btn-default" type='submit' name = 'submitbutton' value = 'nosave'>
instead of :
{!! Form::submit('Yes',['class' => 'btn btn-default', 'name' => 'submitbutton', 'value' => 'save'])!!}
{!! Form::submit('No',['class' => 'btn btn-default', 'name' => 'submitbutton', 'value' => 'nosave'])!!}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us