Files
monica/app/Http/ViewComposers/CountrySelectViewComposer.php
T
webdistortionandRégis Freyd eb386ddf01 Fix alphabetic country list (#130)
I've added a fix for the alphabetic country list, and externalised the country dropdown to a component. This component is powered by a View composer which means that no data tie up is needed in the main controller..Just plonk the include file in the right place and tell it what it should bind to and away you go. There may be other parts of the project that could benefit from using this component now it is in place.
2017-06-08 16:54:30 -04:00

28 lines
430 B
PHP

<?php
namespace App\Http\ViewComposers;
use Illuminate\View\View;
use App\Country;
class CountrySelectViewComposer
{
public function __construct()
{
}
/**
* Bind data to the view.
*
* @param View $view
* @return void
*/
public function compose(View $view)
{
$countries = Country::orderBy('country', 'asc')->get();
$view->with('countries', $countries );
}
}