Skip to content

limewell/laravel-macros

Repository files navigation

laravel-macros

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 [email protected] instead of using the issue tracker.

Credits

License

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

About

laravel-macros

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages