Laravel search is package you can use it to make search query easy.

Overview

Laravel Search

Installation

First, install the package through Composer.

composer require theamasoud/laravel-search

or add this in your project's composer.json file .

"require": {
  "theamasoud/laravel-search": "1.*",
}

Usage

Traits

TheAMasoud\LaravelSearch\Searchable

Add the Searchable trait to your model:

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use TheAMasoud\LaravelSearch\Searchable;

class Message extends Model
{
    use Searchable;
    protected $fillable = ['name','email','subject','message'];
}

Normal Search

first how to make a normel search or fillter, you should use search() method.
and you should pass a two parameters column you need to search or fillter in and the request key thet come from your request

Request key:

Normal Search Example:

$messages = Message::search('name','search')->get();
  • In this example I am trying to search or filter in name column in messages table and the data I will search about it's come from request key search like:($request->search)

Search Multiple

By multiple search you can search in multiple columns and multiple values from request.
how to make a multiple search or fillter, you should use searchMultiple() method.
and you should pass a one array parameter column you need to search or fillter in array key and the request key thet come from your request as a value of key like:['name'=>'search_name','bio'=>'search_bio']

Request keys:

Search Multiple Example:

$messages = Message::searchMultiple(['title'=>'search_title','description'=>'search_desc'])->get();
  • In this example I am trying to search or filter in title column in messages table and the data I will search about it's come from request key search_title like:($request->search) etc... with description

Search In Multiple Columns

By search in multiple you can search in multiple columns and one value from request.
how to make a search in multiple or fillter, you should use searchInMultiple() method.
and you should pass a two parameters columns you need to search or fillter in and the request key thet come from your request as a value of key

Request keys:

Search In Multiple Example:

$messages = Message::searchInMultiple(['title','description','etc...'],'search')->get();
  • In this example I am trying to search or filter in title and description column in messages table and the data I will search about it's come from request key search like:($request->search)

Search In Json Column

By search in json you can search in json column and value from request.
how to make a search in multiple or fillter, you should use jsonSearch() method.
and you should pass a two parameters column you need to search or fillter in and the request key thet come from your request as a value of key

Request keys:

Search In Json Example:

My json colums has:
{
    "ar":"نص عربي",
    "en":"English text"
}
$messages = Message::jsonSearch('title->ar','search')->get();
  • In this example I am trying to search or filter in title column in messages table and the data I will search about it's come from request key search like:($request->search)
You might also like...
A fully featured full text search engine written in PHP
A fully featured full text search engine written in PHP

TNTSearch TNTSearch is a full-text search (FTS) engine written entirely in PHP. A simple configuration allows you to add an amazing search experience

Sphinx Search library provides SphinxQL indexing and searching features

Sphinx Search Sphinx Search library provides SphinxQL indexing and searching features. Introduction Installation Configuration (simple) Usage Search I

Kirby docs search workflow for Alfred
Kirby docs search workflow for Alfred

Kirby Docs search workflow for Alfred 4 An ultra-fast Kirby Docs search workflow for Alfred 4 Installation Download the latest version Install the wor

A TYPO3 extension that integrates the Apache Solr search server with TYPO3 CMS. dkd Internet Service GmbH is developing the extension. Community contributions are welcome. See CONTRIBUTING.md for details.
A TYPO3 extension that integrates the Apache Solr search server with TYPO3 CMS. dkd Internet Service GmbH is developing the extension. Community contributions are welcome. See CONTRIBUTING.md for details.

Apache Solr for TYPO3 CMS A TYPO3 extension that integrates the Apache Solr enterprise search server with TYPO3 CMS. The extension has initially been

A site search engine
A site search engine

THIS PACKAGE IS IN DEVELOPMENT, DO NOT USE IN PRODUCTION YET A site search engine This package can crawl your entire site and index it. Support us We

Support search in flarum by sonic

flarum-sonic Support search by Sonic Install Sonic following this guide Install the extension: composer require ganuonglachanh/sonic Change info in a

Your personal job-search assistant

JobsToMail Your personal job-search assistant About JobsToMail is an open source web application that allows users to sign up to receive emails with j

This modules provides a Search API Backend for Elasticsearch.

Search API ElasticSearch This modules provides a Search API Backend for Elasticsearch. This module uses the official Elasticsearch PHP Client. Feature

Search products, categories, brands or tags with ElasticSearch

ElasticSearch for Shopaholic This plugin allows you to use ElasticSearch as search engine for Shopaholic. Benefits Easy to install, easy to use Opened

Releases(v1.0.0)
Owner
Abdulrahman Masoud
PHP / Golang Developer! When not learning, consider yourself challenged! working @Scandiweb
Abdulrahman Masoud
Build and execute an Elasticsearch search query using a fluent PHP API

PACKAGE IN DEVELOPMENT, DO NOT USE YET Build and execute ElasticSearch queries using a fluent PHP API This package is a lightweight query builder for

Spatie 94 Dec 14, 2022
Laravel Searchable - This package makes it easy to get structured search from a variety of sources

This package makes it easy to get structured search from a variety of sources. Here's an example where we search through some model

Spatie 1.1k Dec 31, 2022
Unmaintained: Laravel Searchy makes user driven searching easy with fuzzy search, basic string matching and more to come!

!! UNMAINTAINED !! This package is no longer maintained Please see Issue #117 Here are some links to alternatives that you may be able to use (I do no

Tom Lingham 533 Nov 25, 2022
Query Builder for Elasticsearch

Query Builder for Elasticsearch

wangzhiqiang 5 Mar 2, 2022
A search package for Laravel 5.

Search Package for Laravel 5 This package provides a unified API across a variety of different full text search services. It currently supports driver

Mark Manos 354 Nov 16, 2022
Driver for Laravel Scout search package based on https://github.com/teamtnt/tntsearch

TNTSearch Driver for Laravel Scout - Laravel 5.3 - 8.0 This package makes it easy to add full text search support to your models with Laravel 5.3 to 8

TNT Studio 1k Dec 27, 2022
Laravel package to search through multiple Eloquent models. Supports sorting, pagination, scoped queries, eager load relationships and searching through single or multiple columns.

Laravel Cross Eloquent Search This Laravel package allows you to search through multiple Eloquent models. It supports sorting, pagination, scoped quer

Protone Media 844 Dec 25, 2022
A php trait to search laravel models

Searchable, a search trait for Laravel Searchable is a trait for Laravel 4.2+ and Laravel 5.0 that adds a simple search function to Eloquent Models. S

Nicolás López Jullian 2k Dec 27, 2022
Search among multiple models with ElasticSearch and Laravel Scout

For PHP8 support use php8 branch For Laravel Framework < 6.0.0 use 3.x branch The package provides the perfect starting point to integrate ElasticSear

Sergey Shlyakhov 592 Dec 25, 2022
This is an open source demo of smart search feature implemented with Laravel and Selectize plugin

Laravel smart search implementation See demo at: http://demos.maxoffsky.com/shop-search/ Tutorial at: http://maxoffsky.com/code-blog/laravel-shop-tuto

Maksim Surguy 215 Sep 8, 2022