简体   繁体   中英

Models field request returns null

I've just added a new field called 'locale' to the users table and I am trying to get its walue with auth()->user()->locale. But I am getting null. When I dd() auth()->user(), I can clearly see locale with its value. Also this filed is mass assignable. Mass assignment is actually active, I mean locale field is in $fillable array. Btw you can see that on the screenshot below.

Calling

dd(auth()->user())

http://prntscr.com/kilhb0

The problem was solved. As @aken-roberts said the problem was in naming. As I see field name locale is reserved, so somehow this field was always returning null.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM