Sorted buttons alphabetically

again...
This commit is contained in:
Julian Prieber 2022-07-31 23:55:20 +02:00
parent 3bf1ed9279
commit 388d2f27b8
2 changed files with 7 additions and 1 deletions

View File

@ -87,7 +87,7 @@ class UserController extends Controller
//Show buttons for add link
public function showButtons()
{
$data['buttons'] = Button::select('name')->get();
$data['buttons'] = Button::select('name')->orderBy('name', 'asc')->get();
return view('studio/add-link', $data);
}

View File

@ -17,9 +17,15 @@
<div class="form-group col-lg-8">
<label for="exampleFormControlSelect1">Button*</label>
<select class="form-control" name="button">
<option> custom </option>
<option> custom_website </option>
@foreach($buttons as $button)
@if (!in_array($button->name, ['custom', 'custom_website', 'heading', 'space']))
<option> {{ $button->name }} </option>
@endif
@endforeach
<option> heading </option>
<option> space </option>
</select>
<br>
<label>* Required fields</label><br>