php - Select-Form with Value integer -


i'm trying edit users via form. far, good.

<div class="form-group">     {{ form::label('admin_level', 'admin?') }}     {{ form::select('admin_level', array(0 => 'no', 1 => 'yes'), null, array('class' => 'form-control')) }} </div> 

my problem is: in rendered version of form, value changes string, need integer value update user. tried delete '' without changes. (as might see above) dd giving me this:

"admin_level" => "0" 

how value in 'admin_level' integer value?

update

i added usercontroller function update:

$request['admin_level'] = (int)$request['admin_level']; 

if dd($request) in attributes it's integer, don't stored with:

 $user->update($request->except(['_token'])); 

the value keeps same.

i solved it!

you have add attribute /app/user.php in array $fillable:

    protected $fillable = [       'name', 'email', 'password', 'admin_level',     ]; 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -