public static function findRegionIdByName($name) { return regions::where('region', $name)->firstOrFail()->id; }
public static function getAllRegionsOptions() { $regions = regions::all(); $output = "<option value = ''>Any region</option>"; foreach ($regions as $region) { $selected = ""; if (isset($_POST['region'])) { if ($_POST['region'] == $region->region) { $selected = " selected "; } } $output .= "<option {$selected} value = '{$region->region}'>{$region->region}</option>"; } return $output; }