PHP code example of signifly / laravel-builder-macros
1. Go to this page and download the library: Download signifly/laravel-builder-macros 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/ */
signifly / laravel-builder-macros example snippets
// Params: $column, $query
$query->addSubSelect('primary_address_id',
Address::select('id')
->where('user_id', $user->id)
->primary()
);
// It adds primary_address_id to the result set
$query->defaultSelectAll()
->join('contacts', 'users.id', '=', 'contacts.user_id')
->addSelect('contacts.name as contact_name');