diff --git a/README.md b/README.md index e95fb36..4b174f1 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,16 @@ composer require newman/laravel-delay ## :book: Usage +### Using as Facade + +```php +use Newman\LaravelDelay\Facades\Delay; + +// ... + +Delay::for(3); +``` + ### Using as Trait ```php diff --git a/composer.json b/composer.json index bc141ee..a9bac04 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,10 @@ "laravel": { "providers": [ "Newman\\LaravelDelay\\DelayServiceProvider" - ] + ], + "aliases": { + "Delay": "Newman\\LaravelDelay\\Facades\\Delay" + } } }, "minimum-stability": "dev", diff --git a/src/Facades/Delay.php b/src/Facades/Delay.php new file mode 100644 index 0000000..19576ef --- /dev/null +++ b/src/Facades/Delay.php @@ -0,0 +1,19 @@ +assertSleep()->assertSleepFor(3); + } +} diff --git a/tests/TestCase.php b/tests/TestCase.php index f79cc6d..f56dbe2 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -7,6 +7,7 @@ use Newman\LaravelDelay\Contracts\DelayContract; use Newman\LaravelDelay\DelayFake; use Newman\LaravelDelay\DelayServiceProvider; +use Newman\LaravelDelay\Facades\Delay; use Orchestra\Testbench\TestCase as BaseTestCase; abstract class TestCase extends BaseTestCase @@ -24,4 +25,11 @@ protected function getPackageProviders($app): array DelayServiceProvider::class, ]; } + + protected function getPackageAliases($app): array + { + return [ + 'Delay' => Delay::class, + ]; + } }