1. Go to this page and download the library: Download longman/laravel-lodash 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/ */
longman / laravel-lodash example snippets
. . .
'debug' => [
'ips' => [ // IP list for enabling debug mode
//'127.0.0.1',
],
],
. . .
$items = (new User)->with([
'photos' => function (BelongsToMany $builder) {
// Select via union. There you should pass pivot table fields array
$builder->limitPerGroupViaUnion(3, ['user_id', 'photo_id']);
// or
// Select via subquery
$builder->limitPerGroupViaSubQuery(3);
}, 'other.relation1', 'other.relation2'
]);
$items = $items->get();
...
\Longman\LaravelLodash\SelfDiagnosis\Checks\AvailableDiskSpace::class => [
'paths' => [
'/' => '100G', // At least 100G should be available for the path "/"
'/var/www' => '5G',
],
],
...
AppStructures::getUserStructure(['avatar?']); // null or the populated subtree
AppStructures::getUserStructure(['avatar?:AdminAvatar']); // with an explicit structure name
AppStructures::getUserStructure(['accounts?.degree']); // nullable parent in a chain
Response::setDataStructuresProvider(AppStructures::class);
$response->assertJsonDataResource('User', $user, relations: ['roles[]']);
$response->assertJsonDataResources('User', $users); // exactly these ids, any order
$response->assertJsonDataResources('User', $users, ordered: true); // and in this sequence
$response->assertJsonDataResources('User', []); // proves the response is empty
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.