Replace select with Searchable component in recurrings' create view
MODIFY
app/Http/Controllers/RecurringController.php
app/Http/Controllers/RecurringController.php
@@ -21,9 +21,13 @@ class RecurringController extends Controller {
}
public function create() {
- return view('recurrings.create', [
- 'tags' => session('space')->tags
- ]);
+ $tags = [];
+
+ foreach (session('space')->tags as $tag) {
+ $tags[] = ['key' => $tag->id, 'label' => $tag->name];
+ }
+
+ return view('recurrings.create', compact('tags'));
}
public function store(Request $request) {

MODIFY
resources/views/recurrings/create.blade.php
resources/views/recurrings/create.blade.php
</div>
<div class="input input--small">
<label>Tag</label>
- <select name="tag">
- <option value="">-</option>
- @foreach ($tags as $tag)
- <option value="{{ $tag->id }}">{{ $tag->name }}</option>
- @endforeach
- </select>
+ <searchable
+ name="tag"
+ :items='@json($tags)'
+ initial="{{ old('tag') }}"></searchable>
@include('partials.validation_error', ['payload' => 'tag'])
</div>
<div class="input input--small">

Replace select with Searchable component in recurrings' create view