Completed
Push — master ( 6123aa...cb7977 )
by Nenad
06:49
created

TNTSearchScoutServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
namespace TeamTNT\Scout;
4
5
use Illuminate\Support\ServiceProvider;
6
use Laravel\Scout\EngineManager;
7
use TeamTNT\TNTSearch\TNTSearch;
8
9
class TNTSearchScoutServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap any application services.
13
     *
14
     * @return void
15
     */
16
    public function boot()
17
    {
18
        $this->app[EngineManager::class]->extend('tntsearch', function () {
19
            $tnt = new TNTSearch();
20
            $driver = config('database.default');
21
            $config = config('scout.tntsearch') + config("database.connections.$driver");
22
23
            $tnt->loadConfig($config);
24
            $tnt->setDatabaseHandle(app('db')->connection()->getPdo());
0 ignored issues
show
Bug introduced by
The method setDatabaseHandle() does not seem to exist on object<TeamTNT\TNTSearch\TNTSearch>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
25
26
            return new Engines\TNTSearchEngine($tnt);
27
        });
28
    }
29
}
30