<form action="{{ route('setTopic'}}" method="post" enctype="multipart/form-data">
@csrf
<div class="select-box">
<label for="select-box1" class="label select-box1"><span class="label-desc">Choose topic</span></label><button type="submit" class="btn btn-outline-success">Save</button>
<select id="select-box1" class="select" name="selectSetTopic">
@foreach($dataCategories as $topic)
<option value="{{$topic->id}}">{{ $topic->name }}</option>
@endforeach
</select>
</div>
</form>
public function setTopic(Request $selectSetTopic) {
dd($selectSetTopic);
return redirect()->route('post')->with('success', 'Ok!');
}
public function setTopic(Request $request) {
$selectSetTopic = $request->input('selectSetTopic');
dd($selectSetTopic);
return redirect()->route('post')->with('success', 'Ok!');
}
// Роут
Route::get('models/{model}', ...);
// Контроллер
public function show(Model $model)
{
// ...
}
public function show(Request $request)
{
dd($request->input('selectSetTopic'));
}