PHP code example of bigenergy / laravel-nplusone-baseline

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

    

bigenergy / laravel-nplusone-baseline example snippets

bash
php artisan vendor:publish --tag=nplusone-config
yaml
- run: php artisan test
- run: php artisan nplusone:check

  ERROR  1 new N+1 query introduced.

  ✗ App\Models\Order::customer ×14
      at app/Http/Resources/OrderResource.php:22
      in Tests\Feature\OrderApiTest::test_index

  Fix them with eager loading, or accept them with: php artisan nplusone:baseline