-
app/Http/ViewComposers/CurrencySelectViewComposer.php
Open in GitHubuse Illuminate\View\View; use App\Models\Settings\Currency; class CurrencySelectViewComposer { public function compose(View $view) { $currencies = Currency::orderBy('name', 'asc')->get(); $view->with('currencies', $currencies); } }
-
resources/views/partials/components/currency-select.blade.php
Open in GitHub<select name="currency_id" id="currency_id" class="form-control" required> @foreach ( $currencies as $currency ) @if ($currency->id == $selectionID) <option value="{{ $currency->id }}" selected>{{ $currency->name }}</option> @else <option value="{{ $currency->id }}" >{{ $currency->name }}</option> @endif @endforeach </select>