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 //Show buttons for add link
public function showButtons() public function showButtons()
{ {
$data['buttons'] = Button::select('name')->get(); $data['buttons'] = Button::select('name')->orderBy('name', 'asc')->get();
return view('studio/add-link', $data); return view('studio/add-link', $data);
} }

View File

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