PHP noob here, я застрял на каком-то этапе моего личного проекта. Я хочу показать вторую цену (сайт аренды) для объекта, но мне не удалось показать вторую цену. Я вставлю код и снимок. Результат
Итак, я бы хотел, чтобы пользователь ввел две ставки для элемента и отобразил их на странице сведений об элементе. Итак, проблема в том, что вторая скорость не регистрируется.
Код делится на create.blade.php
(где пользователь вводит данные) и details.blade.php
(отвечает за итоговое изображение).
<!-- CREATE.BLADE.PHP CODE HERE -->
<!-- customFields -->
<div id="customFields"></div>
<!-- price -->
<?php $priceError = (isset($errors) and $errors->has('price')) ? ' is-invalid' : ''; ?>
<div id="priceBloc" class="form-group row">
<label class="col-md-3 col-form-label" for="price">{{ t('Price') }}</label>
<div class="input-group col-md-8">
<div class="input-group-prepend">
<span class="input-group-text">{!! config('currency')['symbol'] !!}</span>
</div>
<input id="price"
name="price"
class="form-control{{ $priceError }}"
placeholder="{{ t('e.i. 15000') }}"
type="text" value="{{ old('price') }}"
>
<div class="input-group-append">
<span class="input-group-text">
<input id="negotiable" name="negotiable" type="checkbox"
value="1" {{ (old('negotiable')=='1') ? 'checked="checked"' : '' }}> <small>{{ t('Negotiable') }}</small>
</span>
</div>
</div>
</div>
<!-- Price 2-->
<?php $priceError = (isset($errors) and $errors->has('price2')) ? ' is-invalid' : ''; ?>
<div id="priceBloc" class="form-group row">
<label class="col-md-3 col-form-label" for="price2">Rate per Week</label>
<div class="input-group col-md-8">
<div class="input-group-prepend">
<span class="input-group-text">{!! config('currency')['symbol'] !!}</span>
</div>
<input id="price2"
name="price2"
class="form-control{{ $priceError }}"
placeholder="{{ t('e.i. 15000') }}"
type="text" value="{{ old('price2') }}"
>
<div class="input-group-append">
<span class="input-group-text">
<input id="negotiable" name="negotiable" type="checkbox"
value="1" {{ (old('negotiable')=='1') ? 'checked="checked"' : '' }}> <small>{{ t('Negotiable') }}</small>
</span>
</div>
</div>
</div>
<!-- END -->
Содержимое details.blade.php
:
<!--DETAILS.BLADE.PHP CODE HERE -->
@if (!in_array($post->category->type, ['not-salable']))
<!-- Price / Salary -->
<div class="detail-line-lite col-md-6 col-sm-6 col-xs-6">
<div>
<span>
{{ (!in_array($post->category->type, ['job-offer', 'job-search'])) ? t('Price') : t('Salary') }}:
</span>
<span>
@if ($post->price > 0)
{!! \App\Helpers\Number::money($post->price) !!}
@else
{!! \App\Helpers\Number::money(' --') !!}
@endif
@if ($post->negotiable == 1)
<small class="label badge-success"> {{ t('Negotiable') }}</small>
@endif
</span>
</div>
</div>
<!-- Price 2 / Salary -->
<div class="detail-line-lite col-md-6 col-sm-6 col-xs-6">
<div>
<span>
{{ (!in_array($post->category->type, ['job-offer', 'job-search'])) ? t('Price per week') : t('Salary') }}:
</span>
<span>
@if ($post->price2 > 0)
{!! \App\Helpers\Number::money($post->price2) !!}
@else
{!! \App\Helpers\Number::money(' --') !!}
@endif
@if ($post->negotiable == 1)
<small class="label badge-success"> {{ t('Negotiable') }}</small>
@endif
</span>
</div>
</div>
<!-- END-->
СПАСИБО ЗА ЛЮБУЮ ПОМОЩЬ :)