ssistemas / searchable by santty

Laravel 5 searchable
21
0
2
Package Data
Maintainer Username: santty
Maintainer Contact: santiago.l.monteiro@gmail.com (Santiago Lima Monteiro)
Package Create Date: 2017-04-06
Package Last Update: 2017-09-23
Language: PHP
License: MIT
Last Refreshed: 2024-11-22 15:01:56
Package Statistics
Total Downloads: 21
Monthly Downloads: 1
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Searchable for Laravel 5.*

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();