An open API service indexing awesome lists of open source software.

https://github.com/vskut/laravel5-model-searchable

Search scope for laravel models
https://github.com/vskut/laravel5-model-searchable

eloquent-models laravel laravel-framework laravel5 php php7 search searchable

Last synced: about 1 year ago
JSON representation

Search scope for laravel models

Awesome Lists containing this project

README

          

# Laravel 5 Model Trait Searchable

Provides the searching trait for Laravel Eloquent models.

This package has been developed by Markus Lind. Visit me at [vskut.ru](http://vskut.ru).

## Install

Via composer:

`$ composer require vskut/laravel5-model-searchable`

## Usage
### Model
```php
use vskut\laravel5ModelSearchable\Searchable;

class User extends Model
{
use Searchable;

}
```

### Controller
```php
class UserController
{

public function index()
{
$user = User::searchable(request()->get('search'), ['id', 'email', 'username'])
->get();

return view('user.index', compact('user'));
}
}
```

### View
```html


Search

```

## Credits

* [Markus Lind](https://github.com/vskut)
* [All Contributors](https://github.com/vskut/laravel5-model-searchable/contributors)

## License

The MIT License (MIT).