I am having a hard time with Laravel. I have a query that returns all the table columns. The problem is that a field "foto" returns as an empty string in the JSON when I use the "get" or "find" methods. Paginate it works as expected.
this query:
$resultado = $query
->where('id_admin', '=', $id_admin)
->with('telasPermissao.itemPermissao')
->paginate(50);
foto comes as "foto": "data/image:93483940349"
Now, with this:
$resultado = $query
->where('id_admin', '=', $id_admin)
->with('telasPermissao.itemPermissao')
->find(1);
$resultado = $query
->where('id_admin', '=', $id_admin)
->with('telasPermissao.itemPermissao')
->get(50);
foto comes as "foto" : ""
I am returning the data from the controller like this:
return response()->json($resultado, 200);
In my operador model I have the following mutator:
public function getFotoAttribute($value)
{
if ($value != null)
{
return pg_escape_string(fgets($value));
}
return null;
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire