Контроллер
public function edit($id)
{
$ad = Ad::find($id);
return view('update', [
'ad' => $ad
]);
}
public function update(Request $request, $id)
{
$ad = Ad::find($id);
$data = $request->all();
$result = $ad->fill($data)->save();
return redirect('/');
}
Роут
Route::get('/edit/{id}', 'AdController@update')->name('adUpdate');
Вьюха update.blade.php
<form method="post" class="col-md-6" action="{{ route(''adUpdate) }}">
@method('PATCH')
<div class="form-group">
<label>Title</label>
<input type="text" name="title" class="form-control">
@error ('title')
<small class="form-text text-danger">{{ $message }}</small>
@enderror
</div>
<div class="form-group">
<label>Description</label>
<textarea type="text" name="description" class="form-control"></textarea>
@error ('description')
<small class="form-text text-danger">{{ $message }}</small>
@enderror
</div>
<button type="submit" class="btn btn-primary">Create</button>
@csrf
</form>