New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

vluzrmos/eloquent-simple-searchable

An Eloquent Simple Searchable Scope.
216 2

Larablocks Analysis

vluzrmos/eloquent-simple-searchable works with Laravel 5 to 8 (latest release v0.1.1, Aug 31, 2021), all past end of life (the last on Jan 24, 2023): no more fixes, even for security.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 5 to 8, past end of life since Jan 24, 2023
  • No release in the last 12 months (last: Aug 31, 2021)
  • 4 downloads a month (needs 10,000)
  • 2 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Aug 31, 2021.
  • No releases in the last 12 months.
  • First released: Sep 15, 2015.
  • Monthly downloads: 4.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 4, 2026.

Install
composer require vluzrmos/eloquent-simple-searchable
Latest Version:v0.1.1
Laravel:5 – 8
License:MIT
Last Updated:Aug 31, 2021
Links: GitHub  ·  Packagist
Maintainer: vluzrmos

Eloquent Simple Searchable

Latest Stable Version Total Downloads Latest Unstable Version License

Installation

composer require vluzrmos/eloquent-simple-searchable

Usage

Put that trait into your model:


namespace App;

use Illuminate\Database\Eloquent\Model;
use Vluzrmos\SimpleSearchable\Eloquent\SimpleSearchableTrait;

class User extends Model
{ 
	use SimpleSearchableTrait;

	protected $searchable = [
		'field' => 'type'
	];
}

The attribute $searchable should contain the index with a column or a related column and the value is a type of the search which includes:

  • left_text: Match the left side of the column value
  • right_text: Match the right side of the column value
  • equals: The searchd text should be equals to the column value
  • full_text: The searched text should be in any position of the searchd column.

Real Life Usage


namespace App;

use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;

use Vluzrmos\SimpleSearchable\Eloquent\SimpleSearchableTrait;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
	use Authenticatable, CanResetPassword, SimpleSearchableTrait;

	protected $searchable = [
		'name' => 'full_text',
		'posts.title' => 'full_text',
		// query deeply into your relations, that relations should exists on the respective models.
		'posts.comments.owner.name' => 'full_text'
	];

	public function posts()
	{
		return $this->hasMany(Post::class);
	}
}

And in your controller or anywhere:

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

// or replace the default searchable fields:

$users = User::search('Jonh', ['name' => 'full_text'])->get();

Note: The search method is a scope, so you need to use query builder methods like get or all to perform the search and get a collection of the results.

Related Packages

yadakhov/insert-on-duplicate-key

A trait for MySQL INSERT ON DUPLICATE KEY UPDATE.

3,149,973 275
audunru/eager-load-pivot-relations

Eager load pivot relations for Laravel Eloquent's BelongsToMany relation.

81,294 9
someonefamous/laravel-findby

Extended 'find' functionality for Eloquent (Laravel).

11,661 3
atoms/database-illuminate

Illuminate bridge for Atoms: the Laravel query builder and Eloquent models again...

63 0
hpolthof/laravel-eloquent-settings

Allow for dynamic blobbed settings in Eloquent models.

52 1

Version History

Version Released Laravel License
v0.1.1 >=5.0 <9 MIT
v0.1.0 >=5.0 <9 MIT
v0.0.5 >=5.0 <9 MIT
v0.0.4 >=5.0 <9 MIT
v0.0.3 ~5.0 MIT