Bribin
1 year ago
325
17
Laravel

Check if the Object request is empty before for each

Posted 1 year ago by Bribin
<tr >
<td> {!! Form::text('contacts[][first_name]',NULL, ['class' => 'form-control'] ) !!}</td>
<td> {!! Form::text('contacts[][last_name]',NULL, ['class' => 'form-control'] ) !!}</td>
<td> {!! Form::text('contacts[][contact_email]',NULL, ['class' => 'form-control'] ) !!}</td>
<td> {!! Form::text('contacts[][contact_phone]',NULL, ['class' => 'form-control'] ) !!}</td>
<td> {!! Form::text('contacts[][contact_department]',NULL, ['class' => 'form-control'] ) !!}</td>
 </tr>

check if the Object request is empty before foreach, without form validation


if(empty($request->contacts))
{
 do something
}

Please sign in or create an account to participate in this conversation.