PHP code example of akkurateio / laravel-search

1. Go to this page and download the library: Download akkurateio/laravel-search library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

akkurateio / laravel-search example snippets


'eloquent' => [
    'searchable' => [
        [
            'model' => \Akkurate\LaravelCore\Models\Account::class,
            'attributes' => ['name']
        ],
        [
            'model' => \Akkurate\LaravelCore\Models\User::class,
            'attributes' => ['firstname', 'lastname', 'email']
        ],
        [
            'model' => \Akkurate\LaravelBlog\Models\Article::class,
            'attributes' => ['title', 'overview', 'description']
        ],
        [
            'model' => \Akkurate\LaravelCrm\Models\Company::class,
            'attributes' => ['name', 'overview']
        ],
        [
            'model' => \Akkurate\LaravelCrm\Models\Contact::class,
            'attributes' => ['firstname', 'lastname', 'job']
        ],
        [
            'model' => \Akkurate\LaravelCrm\Models\Lead::class,
            'attributes' => ['reference', 'name', 'overview']
        ],
        [
            'model' => \Akkurate\LaravelFaq\Models\Question::class,
            'attributes' => ['title', 'content']
        ],
    ],
],
bash
php artisan vendor:publish --provider="Akkurate\LaravelSearch\LaravelSearchServiceProvider" --tag="config"
bash
php artisan vendor:publish --provider="Akkurate\LaravelSearch\LaravelSearchServiceProvider" --tag="views"
bash
php artisan vendor:publish --provider="Akkurate\LaravelSearch\LaravelSearchServiceProvider" --tag="akk4search"
bash
php artisan vendor:publish --provider="Akkurate\LaravelSearch\LaravelSearchServiceProvider" --tag="entries"

public function getEntities()
{
    return [
            'uuid' => $this->account->searchable->uuid,
            'name' => $this->account->searchable->name,
        ];
}

php artisan search:check

php artisan search:sync

php artisan search:query subvitamine

php artisan search:clear

php artisan search:clear --entities=ADMIN_ACCOUNT --entities=ADMIN_USER

php artisan search:clear --sync