Я использую выпадающий список, и его значение параметра равно $ account-> code, но оно показывает код и имя
, поэтому я хочу сохранить код в своем столбце и имя в другом столбце
здесь мой код лезвия:
<div class="form-group col-md-4">
<label>@lang('site.from_account_number')</label>
<select class="form-control select2" style="width: 100%;" name="from_account_number" id="from_account_number">
@foreach ($accounts as $account)
<option value="{{ $account->code }}">
{{ $account->code }} - {{ $account->name }}
</option>
@endforeach
</select>
</div>
, а вот мой код контроллера:
$depositaction->from_account_number = $request->get('from_account_number');
$record_from_acc_name = Account::find($request->get('from_account_number'));
$depositaction->from_account_name = $record_from_acc_name->name;
, но я получаю сообщение об ошибке:
ErrorException (E_NOTICE) Trying to get property 'name' of non-object