I have a controller that returns a JSON string as below
$response = Response::json(array("success"=>"true","token"=>$token));
the return value is {"success":"true","token":{}} but when I put a static value like
$response = Response::json(array("success"=>"true","token"=>"12345"));
the return value is correct {"success":"true","token":"12345"}
The variable $token is generated as it is inserted into the database, but not returned properly.
Token is generated from webpatser UUID using: Uuid:generate();
Question: How can I fix that?
UPD:
The var_dump($token) results:
["string":protected]=> string(36) "d0c95650-3269-11e4-a55e-15cdb906eead"
UPD 2:
$response = Response::json(array("success"=>"true","token"=>$token[0]));
returns {"success":"true","token":NULL}
Tried changing the value of $token to other variables such that
$test = "test";
then
$response = Response::json(array("success"=>"true","token"=>$test));
return {"success":"true","token":"test"}
$tokenwithvar_dump()? What have it shown?