laravel collection object keys iterate code example Example: loop object property laravel foreach( $project->toArray() as $key => $value ) { echo $key; }