Léo Coco
Léo Coco

Reputation: 4282

Can't use a new provider in Laravel

I would like to use Laravel Searchy github here in my RegisterController.php using Laravel 5.4 I followed this :


Add the service provider to the providers array in Laravel's ./config/app.php file:

TomLingham\Searchy\SearchyServiceProvider::class

Add the Alias to the aliases array in Laravel's ./config/app.php file if you want to have quick access to it in your application:

'Searchy' => TomLingham\Searchy\Facades\Searchy::class


Problem

Class searchy does not exist

RegisterController.php

namespace App\Http\Controllers\Auth;

use Searchy;

class RegisterController extends Controller { 
    public function example () {
        Searchy::search('companies')->fields('name')->query('test')->getQuery()->limit(1)->get();
    }   
}

Question

What should I do to be able to use it ?

Upvotes: 1

Views: 286

Answers (1)

Add This In Top of Your File

use TomLingham\Searchy\SearchBuilder;

OR

Try This In Composer

php artisan vendor:publish

Upvotes: 1

Related Questions