PHP code example of sydante / laravel-eloquent-with-not-overwritten

1. Go to this page and download the library: Download sydante/laravel-eloquent-with-not-overwritten 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/ */

    

sydante / laravel-eloquent-with-not-overwritten example snippets


$eloquentModel
    ->with(
        'progresses',
        function (HasMany $builder) {
            $builder->select(['id', 'eloquent_model_id', 'workflow_id', 'status', 'admin_id'])
                ->orderBy('id');
        }
    )
    // Do not overwrite defined eager loaded relations
    ->withNotOverwritten('progresses.admin:id,name')
    ->withNotOverwritten('progresses.workflow:id,name')
    ->withNotOverwritten('progresses.workflow.adminRole:id,name,slug');