Driver for Laravel Scout database search package

2.3.0 2021-06-30 12:30 UTC

This package is auto-updated.

Last update: 2021-10-02 14:49:52 UTC


Laravel Scout Driver based on database search

How to...


1: First, you may use Composer to install APSearch as a required dependency into your Laravel project:

composer require AdrianoPedro/laravel-scout-database-driver

2: Then, you have to publish the database migration into your Laravel project:

php artisan vendor:publish --tag=apsearch-migrations

3: Now, you have to migrate the database migration into your Laravel project:

php artisan migrate --path=/database/migrations/create_searchables_table.php

5: Update your .env and config/scout.php files to set scout driver to apsearch:


	SCOUT_DRIVER = apsearch
	SCOUT_QUEUE  = true //for queueing the process, if false it will be processed emmidiatly uppon creation/update/delete


'algolia' => [
	'id' => env('ALGOLIA_APP_ID', ''),
	'secret' => env('ALGOLIA_SECRET', ''),
'apsearch' => [
    'asYouType'     => true,
    'searchMode'    => "LIKE",  // LIKE, BOOLEAN, NATURAL, DIRECT (direct
                                // search over model collection).
                                // searchModel can also be defined per Model.

5: Add apSearchScoutServiceProvider the providers list on your projects config/app.php:


return [
    'providers' => [

6: Include Scout class on the models you want to implement Searchable:


namespace App\Model;

use Laravel\Scout\Searchable;

class Model extends Model
    use Searchable;

    public searchMode = "LIKE"; // Optional. If not defined config/scout.php
                                // option will be used.

7: Optionally, you can import existing models (using Scout Searchable):

php artisan apsearch:import Path\\To\\Model


APSearch is an open-sourced software licensed under the MIT license.