limewell/laravel-macros

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

This package is not auto-updated.

Last update: 2024-09-19 04:44:51 UTC


README

Latest Version on Packagist Total Downloads GitHub Actions

这里应该放置您的描述。尽量限制为一到两段,并提及您支持的PSR,以避免用户和贡献者产生混淆。

安装

您可以通过composer安装此包

composer require limewell/laravel-macros

用法

Eloquent 构建器

withWhereHas()

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

Schema 蓝图

hasForeign()

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

集合

loadWithLimit()

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

测试

composer test

变更日志

请参阅CHANGELOG了解最近更改的详细信息。

贡献

请参阅CONTRIBUTING获取详细信息。

安全

如果您发现任何与安全相关的问题,请通过电子邮件dipesh.sukhia@gmail.com而不是使用问题跟踪器。

鸣谢

许可

MIT 许可证(MIT)。请参阅许可文件获取更多信息。