Problems with accents in Eloquent query using pluck ()

1

I have problems with an eloquent query when using the collection tool pluck

The accent is perfectly preserved in the BDD

Query using Eloquent

$listFinal[].=FAQ::where("id",$ids)->get()->pluck('answer');

Final result printed with blade

cami\u00f3n
    
asked by victor leon 10.07.2018 в 18:35
source

2 answers

1

Maybe the coding of caratceres in your view is wrong, for this add this tag in your <head>

<meta charset="utf-8">

or

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
// Esto solo en el caso de que tu navegador no soporte HTML5

If it does not work, you may need to change the charset of your database. It looks like you're using phpmyadmin, so do it like this

  • Go to phpmyadmin
  • On the left panel, select the database.
  • Go to Operations in the menu bar.
  • In Collation select ut8_general_ci
  • Finally press Go to save the configuration

After that the characters should come correctly.

    
answered by 10.07.2018 в 22:21
0

in the config / database.php you have to look at this

'mysql' => array(
'driver'    => 'mysql',
'host'      => 'localhost',
'database'  => '',
'username'  => '',
'password'  => '',
'charset'   => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix'    => 'false',
),

try changing the encoding to the one you have in your database

    
answered by 11.07.2018 в 12:03