limewell/laravel-macros

dev-master 2022-06-22 04:48 UTC

This package is not auto-updated.

Last update: 2024-12-12 05:41:19 UTC


README

Latest Version on Packagist Total Downloads GitHub Actions

This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.

Installation

You can install the package via composer:

composer require limewell/laravel-macros

Usage

Eloquent Builder

withWhereHas()

User::query()
    ->withWhereHas('subscriptions', function ($query) {
        $query->where('package_id', 4)->withWhereHas('package');
    })
    ->get();

Schema Blueprint

hasForeign()

Schema::table('subscriptions', function (Blueprint $table) {
    if($table->hasForeign('subscriptions_package_id_foreign')){
        //
    }
});

Collection

loadWithLimit()

Country::all()
    ->loadWithLimit(['states' => function($query){
        $query->limit(1);
    }]);

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email dipesh.sukhia@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.