1. Go to this page and download the library: Download dscmall/laravel-orm-hasin library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dscmall / laravel-orm-hasin example snippets
/**
* SQL:
*
* select * from `product`
* where exists
* (
* select * from `product_skus`
* where `product`.`id` = `product_skus`.`p_id`
* and `product_skus`.`deleted_at` is null
* )
* and `product`.`deleted_at` is null
* limit 10 offset 0
*/
$products = Product::has('skus')->paginate(10);
/**
* SQL:
*
* select * from `product`
* where `product`.`id` IN
* (
* select `product_skus`.`p_id` from `product_skus`
* and `product_skus`.`deleted_at` is null
* )
* and `product`.`deleted_at` is null
* limit 10 offset 0
*/
$products = Product::hasIn('skus')->paginate(10);