Issues (27)

src/FastapiServiceProvider.php (1 issue)

1
<?php
2
3
namespace Larafast\Fastapi;
4
5
use Illuminate\Database\Migrations\MigrationCreator;
6
use Illuminate\Support\ServiceProvider;
7
use Larafast\Fastapi\Console\Commands\ControllerMakeCommand;
8
use Larafast\Fastapi\Console\Commands\FactoryMakeCommand;
9
use Larafast\Fastapi\Console\Commands\Fastapi;
10
use Larafast\Fastapi\Console\Commands\MigrateMakeCommand;
11
use Larafast\Fastapi\Console\Commands\ModelMakeCommand;
12
use Larafast\Fastapi\Console\Commands\RequestMakeCommand;
13
use Larafast\Fastapi\Console\Commands\ResourceMakeCommand;
14
15
class FastapiServiceProvider extends ServiceProvider
16
{
17
18
    protected $commands = [
19
        ControllerMakeCommand::class,
20
        FactoryMakeCommand::class,
21
        Fastapi::class,
22
        MigrateMakeCommand::class,
23
        ModelMakeCommand::class,
24
        RequestMakeCommand::class,
25
        ResourceMakeCommand::class,
26
    ];
27
28
    /**
29
     * Bootstrap the application services.
30
     */
31
    public function boot()
32
    {
33
34
        $this->publishes([
35
            __DIR__ . '/../config/config.php' => config_path('fastApi.php'),
36
        ], 'fastApi');
37
38
39
        // $this->publishes([
40
        //     __DIR__ . '/../resources/stubs' => resource_path('stubs')
41
        // ], 'fastApi');
42
43
44
        $this->app->when(MigrationCreator::class)
45
            ->needs('$customStubPath')
46
            ->give(function ($app) {
0 ignored issues
show
The parameter $app is not used and could be removed. ( Ignorable by Annotation )

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

46
            ->give(function (/** @scrutinizer ignore-unused */ $app) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
47
                return base_path('vendor/larafast/fastapi/resources/stubs');
48
            });
49
50
        $this->commands($this->commands);
51
    }
52
53
    /**
54
     * Register the application services.
55
     */
56
    public function register()
57
    {
58
        // Automatically apply the package configuration
59
        $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'fastApi');
60
61
        // Register the main class to use with the facade
62
        $this->app->singleton('fastApi', function () {
63
            return new Fastapi;
64
        });
65
    }
66
}
67