hi guys, I had an issue with getting value from array that I’ve set it at my gender.php
and here’s the code
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";
}
}
}
and here’s my create.blade code
{!! Form::select('gender', array('Male', 'Female'), null, array('class' => 'form-control')) !!}