Answer the question
In order to leave comments, you need to log in
Why don't put and delete work on hosting?
cloudways hosting. Everything works on local hosting.
This type of form:
<form action="{{ route('ad.update', $ad->id) }}" method="post" enctype="multipart/form-data" name="update">
<div class="form-group">
<label for="title">Название:</label>
<input type="text" name="title" id="title" class="form-control" value="{{ $ad->title }}">
</div>
<div class="form-group">
<label for="category">Категория:</label>
<div class="row">
<div class="col-xs-3">
<select name="category" id="" class="form-control">
@foreach($categories as $category)
@if($category->id == $ad->category_id)
<option value="{{ $category->id }}" selected>{{ $category->name }}</option>
@else
<option value="{{ $category->id }}">{{ $category->name }}</option>
@endif
@endforeach
</select>
</div>
</div>
</div>
<div class="form-group">
<label for="price">Цена:</label>
<input type="text" name="price" id="price" class="form-control" value="{{ $ad->price }}">
</div>
<div class="form-group">
<label for="city">Город:</label>
<input type="text" name="city" id="city" class="form-control" value="{{ $ad->city }}">
</div>
<div class="form-group">
<label for="description">Описание:</label>
<textarea name="description" id="description" cols="30" rows="10" class="form-control">{{ $ad->description }}</textarea>
</div>
<div class="form-group">
<label for="images">Изображения:</label>
<div class="row">
@foreach($ad->adimages as $image)
<div class="col-md-2">
<div class="thumbnail">
<img src="{{ url('images/items/' . $ad->id . '/' . $image->image) }}" alt="" width="50px" class="media-object">
<div class="text-center">
<a href="#" id="{{ $image->id }}" class="btn btn-xs btn-danger deleteLink">Удалить</a>
</div>
</div>
</div>
@endforeach
</div>
<input type="file" name="images[]" id="images" multiple="multiple">
</div>
<input type="hidden" name="_method" value="PUT">
{{ csrf_field() }}
<div class="form-group">
<input type="submit" value="Редактировать объявление" class="btn btn-success">
</div>
</form>
<form action="" method="post" name="deleteForm" id="deleteForm">
<input type="hidden" name="ad_id" id="ad_id" value="{{ $ad->id }}">
<input type="hidden" name="_method" value="DELETE">
{{ csrf_field() }}
</form>
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