Tag : toArray()



How to convert object to array in Laravel 5?

If you require to convert object data from db into array then you can do it using DB facade and Model Eloquent. Sometimes we need to give array data only so we must get array data from db. I have two examples so it can helps you. In first example, If you use Model Eloquent for get data from database then you can do it using toArray(). toArray() will help to convert object into array data. So let's see bellow example and check it. <strong>Example 1:</strong> <pre class="prettyprint lang-php"> $users = User::get()->toArray(); print_r($users); </pre> In this example, if you use DB facade for ge.....

By Hardik Savani | June 2, 2016 | | 17892 Viewer | Category : Laravel
READ MORE

    PHP - Bootstrap autocomplete tokenfield with Ajax Example

    PHP - Bootstrap autocomplete tokenfield with Ajax Example

    Open Post

    Bootstrap progress bar animate example using bootstrap-progressbar.js

    Bootstrap progress bar animate example using bootstrap-progressbar.js

    Open Post

    MySql comma separated column join in PHP Laravel 5

    MySql comma separated column join in PHP Laravel 5

    Open Post

    PHP - File upload progress bar with percentage using form jquery example

    PHP - File upload progress bar with percentage using form jquery example

    Open Post

    Laravel 5 Ajax CRUD with Pagination example and demo from scratch

    Laravel 5 Ajax CRUD with Pagination example and demo from scratch

    Open Post

    Laravel 5.2 chat message module using socket.io, redis, express and nodejs from from scratch.

    Laravel 5.2 chat message module using socket.io, redis, express and nodejs from from scratch.

    Open Post