ikechukwukalu /
requirepin
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Ikechukwukalu\Requirepin; |
||
| 4 | |||
| 5 | use Config; |
||
| 6 | use Ikechukwukalu\Requirepin\Services\PinService; |
||
| 7 | use Ikechukwukalu\Requirepin\Services\ThrottleRequestsService; |
||
| 8 | use Ikechukwukalu\Requirepin\Middleware\RequirePin; |
||
| 9 | use Illuminate\Contracts\Foundation\Application; |
||
| 10 | use Illuminate\Support\ServiceProvider; |
||
| 11 | use Illuminate\Support\Facades\Route; |
||
| 12 | use Illuminate\Routing\Router; |
||
| 13 | |||
| 14 | class RequirePinServiceProvider extends ServiceProvider |
||
| 15 | { |
||
| 16 | public const LANG = __DIR__.'/lang'; |
||
| 17 | public const DB = __DIR__.'/migrations'; |
||
| 18 | public const VIEW = __DIR__.'/views'; |
||
| 19 | public const CONFIG = __DIR__.'/config/requirepin.php'; |
||
| 20 | public const ROUTE_API = __DIR__.'/routes/api.php'; |
||
| 21 | public const ROUTE_WEB = __DIR__.'/routes/web.php'; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Bootstrap the application services. |
||
| 25 | * |
||
| 26 | * @return void |
||
| 27 | */ |
||
| 28 | public function boot() |
||
| 29 | { |
||
| 30 | $router = $this->app->make(Router::class); |
||
| 31 | $router->aliasMiddleware('require.pin', RequirePin::class); |
||
| 32 | |||
| 33 | Route::middleware('api')->prefix('api')->group(function () { |
||
| 34 | $this->loadRoutesFrom(static::ROUTE_API); |
||
| 35 | }); |
||
| 36 | |||
| 37 | Route::middleware('web')->group(function () { |
||
| 38 | $this->loadRoutesFrom(static::ROUTE_WEB); |
||
| 39 | }); |
||
| 40 | |||
| 41 | $this->loadMigrationsFrom(static::DB); |
||
| 42 | $this->loadViewsFrom(static::VIEW, 'requirepin'); |
||
| 43 | $this->loadTranslationsFrom(static::LANG, 'requirepin'); |
||
| 44 | |||
| 45 | $this->publishes([ |
||
| 46 | static::CONFIG => config_path('requirepin.php'), |
||
| 47 | ], 'rp-config'); |
||
| 48 | $this->publishes([ |
||
| 49 | static::DB => database_path('migrations'), |
||
| 50 | ], 'rp-migrations'); |
||
| 51 | $this->publishes([ |
||
| 52 | static::LANG => lang_path('vendor/requirepin'), |
||
| 53 | ], 'rp-lang'); |
||
| 54 | $this->publishes([ |
||
| 55 | static::VIEW => resource_path('views/vendor/requirepin'), |
||
| 56 | ], 'rp-views'); |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * Register the application services. |
||
| 61 | * |
||
| 62 | * @return void |
||
| 63 | */ |
||
| 64 | public function register() |
||
| 65 | { |
||
| 66 | $this->mergeConfigFrom( |
||
| 67 | static::CONFIG, 'require-pin' |
||
| 68 | ); |
||
| 69 | |||
| 70 | $this->app->make(\Ikechukwukalu\Requirepin\Controllers\PinController::class); |
||
| 71 | |||
| 72 | $this->app->bind(ThrottleRequestsService::class, function (Application $app) { |
||
|
0 ignored issues
–
show
|
|||
| 73 | return new ThrottleRequestsService( |
||
| 74 | config('sanctumauthstarter.login.maxAttempts', 3), |
||
| 75 | config('sanctumauthstarter.login.delayMinutes', 1) |
||
| 76 | ); |
||
| 77 | }); |
||
| 78 | |||
| 79 | $this->app->bind('PinService', PinService::class); |
||
| 80 | |||
| 81 | $appConfig = Config::get('app'); |
||
| 82 | $packageFacades = [ |
||
| 83 | 'PinService' => \Ikechukwukalu\Clamavfileupload\Facades\Foundation\PinService::class, |
||
| 84 | ]; |
||
| 85 | $appConfig['aliases'] = array_merge($appConfig['aliases'], $packageFacades); |
||
| 86 | Config::set('app', $appConfig); |
||
| 87 | } |
||
| 88 | } |
||
| 89 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.