Issues (44)

src/DynamicDatabaseConfigServiceProvider.php (6 issues)

Labels
Severity
1
<?php
2
3
namespace Ikechukwukalu\Dynamicdatabaseconfig;
4
5
6
use Ikechukwukalu\Dynamicdatabaseconfig\Console\Commands\DynamicDatabaseConfigMigrateCommand;
7
use Ikechukwukalu\Dynamicdatabaseconfig\Console\Commands\EnvDatabaseConfigMigrateCommand;
8
use Ikechukwukalu\Dynamicdatabaseconfig\Console\Commands\DynamicDatabaseConfigSeedCommand;
9
use Ikechukwukalu\Dynamicdatabaseconfig\Console\Commands\EnvDatabaseConfigSeedCommand;
10
use Ikechukwukalu\Dynamicdatabaseconfig\Middleware\DynamicDatabaseConfig;
11
use Ikechukwukalu\Dynamicdatabaseconfig\Middleware\EnvDatabaseConfig;
12
use Illuminate\Support\ServiceProvider;
13
use Illuminate\Routing\Router;
14
15
class DynamicDatabaseConfigServiceProvider extends ServiceProvider
16
{
17
    public const DB = __DIR__.'/migrations';
18
    public const CONFIG = __DIR__.'/config/dynamicdatabaseconfig.php';
19
20
    /**
21
     * Bootstrap the application services.
22
     *
23
     * @return void
24
     */
25
    public function boot()
26
    {
27
        if ($this->app->runningInConsole()) {
0 ignored issues
show
The method runningInConsole() does not exist on Tests\Laravel\App. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
        if ($this->app->/** @scrutinizer ignore-call */ runningInConsole()) {

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...
28
            $this->commands([
0 ignored issues
show
The method commands() does not exist on Ikechukwukalu\Dynamicdat...seConfigServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
            $this->/** @scrutinizer ignore-call */ 
29
                   commands([

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...
29
                DynamicDatabaseConfigMigrateCommand::class,
30
                EnvDatabaseConfigMigrateCommand::class,
31
                DynamicDatabaseConfigSeedCommand::class,
32
                EnvDatabaseConfigSeedCommand::class
33
            ]);
34
        }
35
36
        $router = $this->app->make(Router::class);
0 ignored issues
show
The method make() does not exist on Tests\Laravel\App. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

36
        /** @scrutinizer ignore-call */ 
37
        $router = $this->app->make(Router::class);

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...
37
        $router->aliasMiddleware('dynamic.database.config', DynamicDatabaseConfig::class);
38
        $router->aliasMiddleware('env.database.config', EnvDatabaseConfig::class);
39
40
       $this->loadMigrationsFrom(self::DB);
0 ignored issues
show
The method loadMigrationsFrom() does not exist on Ikechukwukalu\Dynamicdat...seConfigServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

40
       $this->/** @scrutinizer ignore-call */ 
41
              loadMigrationsFrom(self::DB);

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...
41
42
        $this->publishes([
0 ignored issues
show
The method publishes() does not exist on Ikechukwukalu\Dynamicdat...seConfigServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

42
        $this->/** @scrutinizer ignore-call */ 
43
               publishes([

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...
43
            self::CONFIG => config_path('dynamicdatabaseconfig.php'),
44
        ], 'ddc-config');
45
46
        $this->publishes([
47
            self::DB => database_path('migrations'),
48
        ], 'ddc-migrations');
49
    }
50
51
    /**
52
     * Register the application services.
53
     *
54
     * @return void
55
     */
56
    public function register()
57
    {
58
        $this->mergeConfigFrom(
0 ignored issues
show
The method mergeConfigFrom() does not exist on Ikechukwukalu\Dynamicdat...seConfigServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

58
        $this->/** @scrutinizer ignore-call */ 
59
               mergeConfigFrom(

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...
59
            self::CONFIG, 'dynamicdatabaseconfig'
60
        );
61
    }
62
}
63