I stuck at getting value from app\Helpers\Enums\DriverType.php.
Here's my code:
<?php
namespace App\Helpers\Enums;
final class Gender {
const MALE = 0;
const FEMALE = 1;
public static function getList() {
return [
Gender::MALE,
Gender::FEMALE,
];
}
public static function getArray() {
$result = [];
foreach (self::getList() as $arr) {
$result[$arr] = self::getString($arr);
}
return $result;
}
public static function getString($val) {
switch ($val) {
case 0:
return "Male";
case 1:
return "Female";
}
}
}
?>
my question is how can I get the value from the array in my driver\create.blade. I have tried.
here's my blade code:
{!! Form::model($obj,
[ 'url' => $route,
'method' => $method,
'id' => 'driverCreate',
]) !!}
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group">
<strong>Gender:</strong>
{!! Form::select('gender', array('Male', 'Female'), null, array('class' => 'form-control')) !!}
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12 text-center">
<button type="submit" class="btn btn-primary" >Submit</button>
{!! Form::close() !!}
</div>
any code needed to figure out how this works?