PHP code example of ferrisbane / eloquent-companion

1. Go to this page and download the library: Download ferrisbane/eloquent-companion 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/ */

    

ferrisbane / eloquent-companion example snippets


"ferrisbane/eloquent-companion": "0.1.*"

'providers' => [
    ...

    Ferrisbane\EloquentCompanion\Laravel5ServiceProvider::class

    ...
];

User::where('active', true)
    ->withWhereHas('orders', function($query) {
        $query->where('paid', true);
    })
    ->get();

User::where('active', true)
    ->whereHas('orders', function($query) {
        $query->where('paid', true);
    })
    ->with([
        'orders' => function($query) {
            $query->where('paid', true);
        }
    ])
    ->get();

User::where('email', '[email protected]')
    ->toQuery();