Skip to content

Latest commit

 

History

History
45 lines (30 loc) · 858 Bytes

README.md

File metadata and controls

45 lines (30 loc) · 858 Bytes

Codeigniter Search

Rapid Search for Codeigniter 4 framework

CodeIgniter PHP Version Require

Installation

composer require aselsan/search

Usage

use SearchTrait in your model, as follows:

<?php

namespace App\Models;

use CodeIgniter\Model;

class UserModel extends Model
{
    use SearchTrait; //Add this

    // Optional properties
    protected $search = ['first_name', 'last_name'];

Somewhere in your controller

$keyword = "jhon doe";

// Match any fields
model(UserModel::class)->search($keyword)->paginate();

// Match all fields
model(UserModel::class)->search($keyword, true)->paginate();

License

This project is licensed under the MIT License - see the LICENSE file for details.