PHP code example of pragmarx / coollection
1. Go to this page and download the library: Download pragmarx/coollection library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once ('vendor/autoload.php' );
pragmarx / coollection example snippets php
$collection->name
$collection->addresses->first()->street_name
$collection->flatten()->cars->filter(function ($car) { return $car->name == 'ferrari' })->last()->model
$countries->where('name.common' , 'United States' )->first()->currency->name->english;
php
$collection->cars->unique('constructor' )->last()->model->colors->first()->rgb
php
collect($vimeo)->body->data->first()->metadata->connections->likes->total;
php
collect($vimeo)['body' ]['data' ][0 ]['metadata' ]['connections' ]['likes' ]['total' ];
php
$input = coollect($request->all());
php
$input->pagination->perPage
php
$input->get('pagination' )['perPage' ]
php
$input->get('pagination.perPage' )
php
$collection = new IlluminateExtracted\Support\Collection(['my collection' ]);
php
$c = new Coollection(['first_name' => 'Barack Obama' ]);
$c = coollect(['first_name' => 'Barack Obama' ]);
php
echo $c->first_name;
echo $c->flip()->barak_obama == 'first_name'
? 'true'
: 'false' ;
php
echo $c->rio;
echo $c->RIO;