firefly-iii/app/Providers/SearchServiceProvider.php

60 lines
1.2 KiB
PHP
Raw Normal View History

2016-11-06 07:52:31 -06:00
<?php
/**
* AccountServiceProvider.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
2016-11-06 07:52:31 -06:00
namespace FireflyIII\Providers;
2017-02-05 08:58:27 -06:00
use FireflyIII\Support\Search\Search;
use FireflyIII\Support\Search\SearchInterface;
2016-11-06 07:52:31 -06:00
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
/**
* Class SearchServiceProvider
*
* @package FireflyIII\Providers
*/
class SearchServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->app->bind(
2017-02-05 08:58:27 -06:00
SearchInterface::class,
function (Application $app) {
/** @var Search $search */
$search = app(Search::class);
if ($app->auth->check()) {
$search->setUser(auth()->user());
2016-11-06 07:52:31 -06:00
}
2017-02-05 08:58:27 -06:00
return $search;
2016-11-06 07:52:31 -06:00
}
);
}
}