Answer the question
In order to leave comments, you need to log in
: is it possible to replace the isset($profile->phone_number) construct? $profile->phone_number: null for something less cumbersome?
Good afternoon!
The initial data is standard: there is a profile form with many fields. To create and edit, the same view is used, containing a form with fields.
Done like this:
@if( isset($form)
{!! CollectiveForm::model($form,
[
'method' => 'PATCH',
'class' => 'form-horizontal',
]) !!}
@else
{!! CollectiveForm::open(
[
'method' => 'POST',
'class' => 'form-horizontal',
]) !!}
@endif
Например, код вывода полей такие:
<div class="col-lg-12">
{!! CollectiveForm::text('phone_number', isset($profile->phone_number) ? $profile->phone_number : null,
['class' => 'form-control', 'required' => 'required', 'disabled' => $disabled ]) !!}
</div>
<div class="col-lg-12">
{!! CollectiveForm::text('content', isset($form->content) ? $form->content : null,
['class' => 'form-control', 'required' => 'required', 'disabled' => $disabled ]) !!}
</div>
isset($profile->phone_number) ? $profile->phone_number : null
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question