This is my code
$admin = Admin::find(25);
$admin->picture = $destination;
$admin->save();
but when I execute it, the picture
field is keep NULL
for example images/admin_20
the destination
is a string to the location of the image.
I already tried ->update()
but also nothing becomes saved.
could you help me please
the picture
column in my database is varchar(255) utf8_unicode_ci
Try this:
$admin = Admin::where('id', '=', 25);
$admin->picture = $destination;
$admin->save();
You didn't provide much code but if it's a function
Return $admin->picture;
EDIT
Laravel is UTF8 by default but just to make sure, check the file
/etc/mysql/my.cnf
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
Finally I found the problem, three days working to this silly mistake
the ID
column in my database should have been id
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.