Last active
February 24, 2022 14:30
-
-
Save unisys12/9f01b3ee4f114ff34ceea598d2effefd to your computer and use it in GitHub Desktop.
Generating a Select element with pre-selected options...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select name="tags[]" id="tags" multiple> | |
@foreach ($tags as $tag) | |
<option value="{{ $tag->id }}" | |
@foreach ($quote->tags as $quote_tag) | |
@if ($tag->id == $quote_tag->pivot->tag_id) selected @endif | |
@endforeach | |
> | |
{{ $tag->name }} | |
</option> | |
@endforeach | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment