ssistemas/searchable

Laravel 5 searchable

1.0.0 2017-04-06 00:57 UTC

This package is not auto-updated.

Last update: 2024-11-24 02:03:48 UTC


README

a simple trait to use with your Laravel Models

Usage

Step 1: Install Through Composer

 composer require ssistemas/searchable:"1.*"

Step 2: Install Trait model

just add in your models

    class User extends Model
    {
        use Ssistemas\Searchable\Traits\Searchable;
        private $searchable = [
            'columns'=>['category.name'],
            'joins'=>[
                'customers' => ['category.id','user.category_id'],
            ],
        'orders'=>['category.name,asc'],
        ];
        ...
    }

Step 2: Use Controller

you can also use controller

    $users = User::search($value)->get();