I am new in laravel using Laravel 5.3.
I am creating a check()
function in laravel model for user login
here i get all data form database useing default $thi
So you have a collection with properties. And you can access them just like $collection->first()->firstname
Or if you want to do some operation with all items use each method:
$collection = $collection->each(function ($item, $key) {
$item->firstname .= ' Smith';
});
A very simple way:
$arr = $this->all()->toArray();
var_dump($arr); // oh~ array data!