lundi 30 mai 2016

Laravel 5.1 DB:select toArray()

I have a large SQL statement that I am executing like so:

$result = DB::select($sql);

For example

$result = DB::select('select * from users');

I'd like the result to be an array - but at the moment it returns a structure like so, an array with Objects...

Array
(
    0 => stdClass::__set_state(array(
        'id' => 1,
        'first_name' => 'Pavel',
        'created_at' => '2015-02-23 05:46:33',
    )),
    1 => stdClass::__set_state(array(
        'id' => 2,
        'first_name' => 'Eugene',
        'created_at' => '2016-02-23 05:46:34',
    )),
...etc...

)



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1TT5ut9
via IFTTT

Aucun commentaire:

Enregistrer un commentaire