Saving emojies in Laravel MySQL database

Submitted by tuytoosh - 9 months ago

Laravel MySQL in default returns "SQLSTATE[HY000]: General error: 1366 Incorrect string value" error in emoji save... this error is because Laravel in default uses utf8 charset in MySQL, change your `config/database.php` like below and reset your migration instead putting out that error...

'mysql' => [
    'driver' => 'mysql',
    
	...
	
    'charset' => 'utf8mb4',
    'collation' => 'utf8mb4_unicode_ci',
    
    ...
    

Ads cover the costs of maintaining Laravel-tricks

comments powered by Disqus

Ads cover the costs of maintaining Laravel-tricks