PHP code example of nunomaduro / laravel-any

1. Go to this page and download the library: Download nunomaduro/laravel-any 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/ */

    

nunomaduro / laravel-any example snippets


$users = User::all();

// Returns `true` if the collection is not empty.
$users->any();

// Returns `true` if there is a user with a paid plan.
$users->any(fn ($user) => $user->has_paid_plan);

// Returns `true` if there is a user with a paid plan.
$users->any->has_paid_plan;