Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
HichemTab-tech committed Aug 12, 2023
1 parent 8608d11 commit c23b4b8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 10 deletions.
11 changes: 1 addition & 10 deletions src/Laravel/Providers/TokensValidationProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace HichemtabTech\TokensValidation\Laravel\Providers;

use HichemtabTech\TokensValidation\TokensValidation;
use Illuminate\Support\ServiceProvider;

class TokensValidationProvider extends ServiceProvider
Expand All @@ -15,9 +14,6 @@ class TokensValidationProvider extends ServiceProvider
public function register(): void
{
$this->publishConfig();
$this->app->singleton(TokensValidation::class, function () {
return TokensValidation::class;
});
}

/**
Expand All @@ -29,11 +25,6 @@ public function register(): void
public function boot(): void
{
$this->mergeConfigFrom(__DIR__.'/../config/tokensvalidation.php', 'tokensvalidation');
TokensValidation::setConfig(config('tokensvalidation'));
TokensValidation::prepare();
$this->app->singleton(TokensValidation::class, function () {
return TokensValidation::class;
});
}

/** @noinspection PhpUndefinedFunctionInspection */
Expand All @@ -42,7 +33,7 @@ private function publishConfig(): void
$configPath = __DIR__.'/../config/tokensvalidation.php';
$publishPath = config_path('tokensvalidation.php');
$this->publishes([$configPath => $publishPath], 'tokensvalidation-config');
$providerPath = __DIR__.'/../Providers/TokensValidationProvider.php';
$providerPath = __DIR__.'/../stubs/TokensValidationProvider.php';
$publishPath2 = app_path('Providers/TokensValidationProvider.php');
$this->publishes([$providerPath => $publishPath2], 'tokensvalidation-provider');
$controllerPath = __DIR__.'/../Http/Controllers/InvitationAnswererController.php';
Expand Down
36 changes: 36 additions & 0 deletions src/Laravel/stubs/TokensValidationProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php /** @noinspection PhpUnused */

namespace HichemtabTech\TokensValidation\Laravel\stubs;

use HichemtabTech\TokensValidation\TokensValidation;
use Illuminate\Support\ServiceProvider;

class TokensValidationProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register(): void
{
$this->app->singleton(TokensValidation::class, function () {
return TokensValidation::class;
});
}

/**
* Bootstrap services.
*
* @return void
* @noinspection PhpUndefinedFunctionInspection
*/
public function boot(): void
{
TokensValidation::setConfig(config('tokensvalidation'));
TokensValidation::prepare();
$this->app->singleton(TokensValidation::class, function () {
return TokensValidation::class;
});
}
}

0 comments on commit c23b4b8

Please sign in to comment.