I have this form group:
<select class="form-control" id="sel1" name="status">
@if((auth()->user()->two_factor_auth) === 'off')
<option value="off">Off</option>
<option value="sms">SMS</option>
@else
<option value="off">Off</option>
<option value="sms">SMS</option>
@endif
</select>
And as the action, I added this to the method submit of ProfileController:
public function submit(Request $request)
{
if($data['status'] === 'off'){
$request->user()->update([
'two_factor_auth' => 'off'
]);
}else{...}
}
And then at the DB,users table, I have added two_factor_auth column and it is set to sms by default.
So if the user selects, off, it should update the column and set off. But now the problem is it does not do that somehow...
So what is going wrong here ? How can I fix this issue ?
I would really appreciate any idea or suggestion from you guys...
Thanks in advance.
<option>s in theifandelsestatements, which means as written, it is currently pointless. Is one of those supposed to beon? You can also move theSMSoption out of that@ifso you don't have to write it twice.$data['status']is not how you access that; it's$request->input('status'). Currently,$datais not defined in the code you posted.