-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from ARCANEDEV/update-package
Updating the package
- Loading branch information
Showing
12 changed files
with
88 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
<?php namespace Arcanedev\NoCaptcha; | ||
|
||
use Arcanedev\LaravelHtml\Contracts\FormBuilder; | ||
use Arcanedev\Support\PackageServiceProvider as ServiceProvider; | ||
use Arcanedev\Support\Providers\PackageServiceProvider as ServiceProvider; | ||
use Illuminate\Contracts\Foundation\Application; | ||
use Illuminate\Contracts\Support\DeferrableProvider; | ||
|
||
/** | ||
* Class NoCaptchaServiceProvider | ||
* | ||
* @package Arcanedev\NoCaptcha | ||
* @author ARCANEDEV <[email protected]> | ||
*/ | ||
class NoCaptchaServiceProvider extends ServiceProvider | ||
class NoCaptchaServiceProvider extends ServiceProvider implements DeferrableProvider | ||
{ | ||
/* ----------------------------------------------------------------- | ||
| Properties | ||
|
@@ -32,7 +32,7 @@ class NoCaptchaServiceProvider extends ServiceProvider | |
/** | ||
* Register the service provider. | ||
*/ | ||
public function register() | ||
public function register(): void | ||
{ | ||
parent::register(); | ||
|
||
|
@@ -43,20 +43,17 @@ public function register() | |
/** | ||
* Bootstrap the application events. | ||
*/ | ||
public function boot() | ||
public function boot(): void | ||
{ | ||
parent::boot(); | ||
|
||
$this->publishConfig(); | ||
$this->registerFormMacros($this->app); | ||
} | ||
|
||
/** | ||
* Get the services provided by the provider. | ||
* | ||
* @return array | ||
*/ | ||
public function provides() | ||
public function provides(): array | ||
{ | ||
return [ | ||
Contracts\NoCaptcha::class, | ||
|
@@ -68,11 +65,12 @@ public function provides() | |
| ----------------------------------------------------------------- | ||
*/ | ||
|
||
private function registerNoCaptchaManager() | ||
/** | ||
* Register noCaptcha manager & contract. | ||
*/ | ||
private function registerNoCaptchaManager(): void | ||
{ | ||
$this->singleton(Contracts\NoCaptchaManager::class, function ($app) { | ||
return new NoCaptchaManager($app); | ||
}); | ||
$this->singleton(Contracts\NoCaptchaManager::class, NoCaptchaManager::class); | ||
|
||
$this->bind(Contracts\NoCaptcha::class, function (Application $app) { | ||
/** @var \Illuminate\Contracts\Config\Repository $config */ | ||
|
@@ -83,20 +81,4 @@ private function registerNoCaptchaManager() | |
); | ||
}); | ||
} | ||
|
||
/** | ||
* Register Form Macros. | ||
* | ||
* @param \Illuminate\Contracts\Foundation\Application $app | ||
*/ | ||
private function registerFormMacros($app) | ||
{ | ||
foreach ([FormBuilder::class, 'form'] as $alias) { | ||
if ($app->bound($alias)) { | ||
$app[$alias]->macro('captcha', function($name = null) use ($app) { | ||
return $app[Contracts\NoCaptcha::class]->input($name); | ||
}); | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.