php - Laravel database - how to return results as arrays by default? -


how can make sure laravel database return array default?

for instance:

$data = $this->database->table('user')->get(); 

result:

illuminate\support\collection object (     [items:protected] => array         (             [0] => stdclass object                 (                     [uuid] => jondo                     [email] => barz@bar.com                     [name] => jondo                     [created_on] => 1505239603                     [updated_on] => 0                 )          )  ) 

if use toarray:

print_r($data->toarray); 

result:

array (     [0] => stdclass object         (             [uuid] => jondo             [email] => barz@bar.com             [name] => jondo             [created_on] => 1505239603             [updated_on] => 0         )  ) 

i still stdclass object don't want @ all.

any ideas?

it returns array. try make dd($data); can see array information , elements on it.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -