Answer the question
In order to leave comments, you need to log in
How to display the index of a tag, not its name?
Welcome all. I am familiar with laravel and relationships.
There is html, a list of categories is displayed here. Typical CRUD application.
<select class="form-control select2" multiple="" data-placeholder="Select a State"
style="width: 100%;" name="categories[]" tabindex="-1" aria-hidden="true">
@foreach($categorys as $category)
<option value="{{ $category->id }}">{{ $category->name }}</option>
@endforeach
</select>
$post = post::find($id);
$post->fill($req->all());
$post->categories()->sync($req->categories);
$post->save();
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