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
- Install the package via Composer:
composer require hetparekh21/searchable
Usage
- Use the
Searchabletrait 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; }
- Perform searches using the
scopeSearchmethod:
$users = User::search('John Doe')->get();
- Search Paginated, As easy as laravel default queries
$users = User::search('John Doe')->paginate(10);
Configuration
exceptproperty: Exclude specific columns from the search (optional).useGuardedproperty: 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
其他信息
- 授权协议: MIT
- 更新时间: 2023-12-28