hetparekh21/searchable 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

hetparekh21/searchable

最新稳定版本:1.0.0

Composer 安装命令:

composer require hetparekh21/searchable

包简介

Add simple search functionality to any model

README 文档

README

Effortlessly add search functionality to your Laravel models.

Installation

  1. Install the package via Composer:
composer require hetparekh21/searchable

Usage

  1. Use the Searchable trait in your model:
use hetparekh21\searchable\Searchable;

class User extends Model
{
    use Searchable;

    protected $fillable = [
        'first_name',
        'last_name',
        'email',
        'phone'
    ];

    protected $guarded = ['id'];

    protected $except = ['phone'];

    protected $useGuarded = false;

}
  1. Perform searches using the scopeSearch method:
$users = User::search('John Doe')->get();
  1. Search Paginated, As easy as laravel default queries
$users = User::search('John Doe')->paginate(10);

Configuration

  • except property: Exclude specific columns from the search (optional).
  • useGuarded property: Include guarded attributes in the search (optional).

Contributing

Anyone is welcome to contribute. Fork, make your changes, and then submit a pull request.

License

Searchable is open-sourced software licensed under the MIT license: LICENSE.

统计信息

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

GitHub 信息

  • Stars: 10
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-28