jeudi 12 décembre 2019

in laravel how to use if /else in controller

i am trying to passing value from view to controller , but it not working it was send only "APPROVED"

my view

<div class="form-group row">
  <label for="colFormLabelLg" class="col-md-2 col-sm-3 control-label control-label-lg"><b>DIGITAL SIGNATURE</b></label>
  <div class="col-md-3">
    <div  class="form-group" id=digital_signature > 
      <select  class="form-control" name="digital_signature" value="" required autofocus  >
        <option value=""></option>
        <option style="color:green">WITH DIGITAL SIGNATURE</option>
        <option style="color:green">WITHOUT DIGITAL SIGNATURE</option>
      </select>
    </div>
  </div>
</div> 

my controller

public function new_approvel_update(Request $request, $id)
{  
    if($request->digital_signature == 'WITH DIGITAL SIGNATURE')
    {
          $input= Student::Where('delete_status','NOT DELETED')->find($id);
          $input['center_approved'] = strtoupper ('APPROVED');
          $input['date_of_join'] = $request->date_of_join;   
    } elseif($request->digital_signature == 'WITHOUT DIGITAL SIGNATURE') {     
          $input= Student::Where('delete_status','NOT DELETED')->find($id);
          $input['center_approved'] = strtoupper ('NOT-APPROVED');
          $input['date_of_join'] = $request->date_of_join;
    }

  $certificate->save();

  return redirect('new_application')->with('success',' APPLICATION APPROVED SUCCESSFULLY .');
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire