I modified the register controller AND the user table to have a role attribute as a string:
Schema::table('users', function (Blueprint $table) {
$table->string('role')->nullable()->index();
});
and i have created an enums.php in config folder like this:
return [
'role_types' => [
'ADMIN' => "Admin",
'TEACHER' => "Teacher",
'STUDENT' => "Student",
]];
on the register user view (which is scaffold by default with bootstrap) i made select box to accommodate the selection:
<select class="form-control" id="role" name='role'>
@foreach (Config::get('enums.role_types') as $role)
<option value="{{ $role }}">{{$role}}</option>
@endforeach
</select>
But up on registering the user, the value is NULL.. what am i doing wrong ?
dd(request());"role" => "Teacher". How did you save into database?