I need to know which button was clicked inside a request form on laravel since i have Save and Update buttons.
App\Http\Requests\RegistrationRequest.php
public function rules()
{
$myrule = [ 'name' => 'required', 'age' => 'required' ];
if (isset($_POST['save']))
{
$myrule['application_form'] = 'required';
}
elseif (isset($_POST['update']))
{
$myrule['application_form'] = 'required_without:is_application_form';
}
return $myrule;
}
i need to know if the button that was click is Save or Update because I'm requiring for the application_form file field to be required if the Save button is clicked but I only require the application_form field if the is_application_form hidden field is empty.
the setup above is working for name and age field but ignores the codes inside the IF conditions.