laravel how to update a field to a database

This is my code

$admin = Admin::find(25);
        $admin->picture = $destination;

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

Edit 1

the picture column in my database is varchar(255) utf8_unicode_ci


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Try this:

     $admin = Admin::where('id', '=', 25);
     $admin->picture = $destination;

You didn’t provide much code but if it’s a function
      Return $admin->picture;


Laravel is UTF8 by default but just to make sure, check the file

 collation-server = utf8_unicode_ci
 init-connect='SET NAMES utf8'
 character-set-server = utf8

Method 2

Finally I found the problem, three days working to this silly mistake

the ID column in my database should have been id

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x