PHP code example of designmynight / laravel-recursive-collection
1. Go to this page and download the library: Download designmynight/laravel-recursive-collection 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');
/* Start to develop here. Best regards https://php-download.com/ */
designmynight / laravel-recursive-collection example snippets
DesignMyNight\Laravel\RecursiveCollectionServiceProvider::class,
$app->register(DesignMyNight\Laravel\RecursiveCollectionServiceProvider::class);
$data = [
[
'name' => 'John Doe',
'email' => '[email protected]',
'bookings' => [
[
'venue' => 'Venue A',
'date' => '2000-01-01'
'guests' => 2
],
[
'venue' => 'Venue B',
'date' => '2001-01-01'
'guests' => 2
],
],
],
];
$collection = (new Collection($data))->recursive();
$collection = collect($data)->recursive(); // Shorthand