定制 zaratedev/laravel-excludable 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zaratedev/laravel-excludable

最新稳定版本:v1.0.1

Composer 安装命令:

composer require zaratedev/laravel-excludable

包简介

Exclude the provided elements from the query results.

README 文档

README

Latest Version on Packagist Total Downloads GitHub Actions

Banner

This package allow to your eloquent models apply exclude provides elements from the query results.

Installation

You can install the package via composer:

composer require zaratedev/laravel-excludable

Usage

Use the Excludable trait in any Eloquent Model.

use Illuminate\Database\Eloquent\Model;
use ZarateDev\LaravelExcludable\Excludable;

class User extends Model
{
    use Excludable;
}

Now you have available scope exclude() method in Eloquent Model.

use App\Models\User;

class UserController extends Controller
{
    public function index()
    {
        $user = auth()->user();

        $users = User::query()->exclude($user)->get();

        return view('users.index', compact('users'));
    }
}

The method exclude can recieved attribute of type collection, model, integer, array. For more examples see test suits.

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 zaratedev@gmail.com instead of using the issue tracker.

Credits

License

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

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-16