From ee09e2bc3d214b4bed1a1b457cc823f294410be0 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Thu, 27 Jun 2024 08:31:41 +1000 Subject: [PATCH] Update docs --- readme.md | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/readme.md b/readme.md index 6c0929f..269395c 100644 --- a/readme.md +++ b/readme.md @@ -19,8 +19,6 @@ composer require timacdonald/has-parameters To get started with an example, I'm going to use a stripped back version of Laravel's `ThrottleRequests`. First up, add the `HasParameters` trait to your middleware. ```php -middleware([ ThrottleRequests::with([ @@ -53,8 +49,6 @@ The static `with()` method allows you to easily see which values represent what The order of the keys does not matter. The trait will pair up the keys to the parameter names in the `handle()` method. ```php -middleware([ @@ -76,8 +70,6 @@ Route::stuff() If any parameters in the `handle` method have a default value, you do not need to pass them through - unless you are changing their value. As an example, if you'd like to only specify a prefix for the `ThrottleRequests` middleware, but keep the `$decayMinutes` and `$maxAttempts` as their default values, you can do the following... ```php -middleware([ ThrottleRequests::with([ @@ -93,16 +85,12 @@ As we saw previously in the handle method, the default values of `$decayMinutes` When your middleware ends in a variadic paramater, you can pass an array of values for the variadic parameter key. Take a look at the following `handle()` method. ```php -middleware([ Authorize::with([ @@ -117,8 +105,6 @@ Route::stuff() Some middleware will have different behaviour based on the type of values passed through to a specific parameter. As an example, Laravel's `ThrottleRequests` middleware allows you to pass the name of a rate limiter to the `$maxAttempts` parameter, instead of a numeric value, in order to utilise that named limiter on the endpoint. ```php -middleware([ ThrottleRequests::with([ @@ -151,8 +135,6 @@ Route::stuff() To achieve this, you can setup a parameter alias map in your middleware... ```php -middleware([ EnsurePostState::in([PostState::DRAFT, PostState::UNDER_REVIEW]),