Skip to content

Commit

Permalink
Merge branch '8.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 19, 2022
2 parents 9f9ff3a + 48aef38 commit 4356a4b
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 7 deletions.
14 changes: 13 additions & 1 deletion broadcasting.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,19 @@ By default, each broadcast event is placed on the default queue for the default
*/
public $queue = 'default';

If you want to broadcast your event using the `sync` queue instead of the default queue driver, you can implement the `ShouldBroadcastNow` interface instead of `ShouldBroadcast`:
Alternatively, you may customize the queue name by defining a `broadcastQueue` method on your event:

/**
* The name of the queue on which to place the broadcasting job.
*
* @return string
*/
public function broadcastQueue()
{
return 'default';
}

If you would like to broadcast your event using the `sync` queue instead of the default queue driver, you can implement the `ShouldBroadcastNow` interface instead of `ShouldBroadcast`:

<?php

Expand Down
26 changes: 26 additions & 0 deletions collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ For the majority of the remaining collection documentation, we'll discuss each m
[sortDesc](#method-sortdesc)
[sortKeys](#method-sortkeys)
[sortKeysDesc](#method-sortkeysdesc)
[sortKeysUsing](#method-sortkeysusing)
[splice](#method-splice)
[split](#method-split)
[splitIn](#method-splitin)
Expand Down Expand Up @@ -2319,6 +2320,31 @@ The `sortKeys` method sorts the collection by the keys of the underlying associa

This method has the same signature as the [`sortKeys`](#method-sortkeys) method, but will sort the collection in the opposite order.

<a name="method-sortkeysusing"></a>
#### `sortKeysUsing()` {.collection-method}

The `sortKeysUsing` method sorts the collection by the keys of the underlying associative array using a callback:

$collection = collect([
'ID' => 22345,
'first' => 'John',
'last' => 'Doe',
]);

$sorted = $collection->sortKeysUsing('strnatcasecmp');

$sorted->all();

/*
[
'first' => 'John',
'ID' => 22345,
'last' => 'Doe',
]
*/

The callback must be a comparison function that returns an integer less than, equal to, or greater than zero. For more information, refer to the PHP documentation on [`uksort`](https://www.php.net/manual/en/function.uksort.php#refsect1-function.uksort-parameters), which is the PHP function that `sortKeysUsing` method utilizes internally.

<a name="method-splice"></a>
#### `splice()` {.collection-method}

Expand Down
41 changes: 40 additions & 1 deletion helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Laravel includes a variety of global "helper" PHP functions. Many of these funct
[Str::substrCount](#method-str-substrcount)
[Str::substrReplace](#method-str-substrreplace)
[Str::title](#method-title-case)
[Str::toHtmlString](#method-to-html-string)
[Str::toHtmlString](#method-str-to-html-string)
[Str::ucfirst](#method-str-ucfirst)
[Str::upper](#method-str-upper)
[Str::uuid](#method-str-uuid)
Expand All @@ -157,6 +157,7 @@ Laravel includes a variety of global "helper" PHP functions. Many of these funct
[basename](#method-fluent-str-basename)
[before](#method-fluent-str-before)
[beforeLast](#method-fluent-str-before-last)
[between](#method-fluent-str-between)
[camel](#method-fluent-str-camel)
[contains](#method-fluent-str-contains)
[containsAll](#method-fluent-str-contains-all)
Expand Down Expand Up @@ -1903,6 +1904,17 @@ The `beforeLast` method returns everything before the last occurrence of the giv

// 'This '

<a name="method-fluent-str-between"></a>
#### `between` {.collection-method}

The `between` method returns the portion of a string between two values:

use Illuminate\Support\Str;

$converted = Str::of('This is my name')->between('This', 'name');

// ' is my '

<a name="method-fluent-str-camel"></a>
#### `camel` {.collection-method}

Expand Down Expand Up @@ -2637,6 +2649,33 @@ The `when` method invokes the given closure if a given condition is `true`. The

If necessary, you may pass another closure as the third parameter to the `when` method. This closure will execute if the condition parameter evaluates to `false`.

<a name="method-fluent-str-when-contains"></a>
#### `whenContains` {.collection-method}

The `whenContains` method invokes the given closure if the string contains the given value. The closure will receive the fluent string instance:

use Illuminate\Support\Str;

$string = Str::of('tony stark')
->whenContains('tony', function ($string) {
return $string->title();
});

// 'Tony Stark'

If necessary, you may pass another closure as the third parameter to the `when` method. This closure will execute if the string does not contain the given value.

You may also pass an array of values to determine if the given string contains any of the values in the array:

use Illuminate\Support\Str;

$string = Str::of('tony stark')
->whenContains(['tony', 'hulk'], function ($string) {
return $string->title();
});

// Tony Stark

<a name="method-fluent-str-when-contains-all"></a>
#### `whenContainsAll` {.collection-method}

Expand Down
2 changes: 2 additions & 0 deletions passport.md
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ To retrieve a token using this grant type, make a request to the `oauth/token` e

Sometimes, your users may want to issue access tokens to themselves without going through the typical authorization code redirect flow. Allowing users to issue tokens to themselves via your application's UI can be useful for allowing users to experiment with your API or may serve as a simpler approach to issuing access tokens in general.

> {tip} If your application is primarily using Passport to issue personal access tokens, consider using [Laravel Sanctum](/docs/{{version}}/sanctum), Laravel's light-weight first-party library for issuing API access tokens.
<a name="creating-a-personal-access-client"></a>
### Creating A Personal Access Client

Expand Down
25 changes: 24 additions & 1 deletion redis.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ By default, Laravel will use the phpredis extension to communicate with Redis. T
// Rest of Redis configuration...
],

In addition to the default `host`, `port`, `database`, and `password` server configuration options, phpredis supports the following additional connection parameters: `name`, `persistent`, `prefix`, `read_timeout`, `retry_interval`, `timeout`, and `context`. You may add any of these options to your Redis server configuration in the `config/database.php` configuration file:
In addition to the default `scheme`, `host`, `port`, `database`, and `password` server configuration options, phpredis supports the following additional connection parameters: `name`, `persistent`, `persistent_id`, `prefix`, `read_timeout`, `retry_interval`, `timeout`, and `context`. You may add any of these options to your Redis server configuration in the `config/database.php` configuration file:

'default' => [
'host' => env('REDIS_HOST', 'localhost'),
Expand All @@ -176,6 +176,29 @@ In addition to the default `host`, `port`, `database`, and `password` server con
],
],

<a name="phpredis-serialization"></a>
#### phpredis Serialization & Compression

The phpredis extension may also be configured to use a variety serialization and compression algorithms. These algorithms can be configured via the `options` array of your Redis configuration:

use Redis;

'redis' => [

'client' => env('REDIS_CLIENT', 'phpredis'),

'options' => [
'serializer' => Redis::SERIALIZER_MSGPACK,
'compression' => Redis::COMPRESSION_LZ4,
],

// Rest of Redis configuration...
],

Currently supported serialization algorithms include: `Redis::SERIALIZER_NONE` (default), `Redis::SERIALIZER_PHP`, `Redis::SERIALIZER_JSON`, `Redis::SERIALIZER_IGBINARY`, and `Redis::SERIALIZER_MSGPACK`.

Supported compression algorithms include: `Redis::COMPRESSION_NONE` (default), `Redis::COMPRESSION_LZF`, `Redis::COMPRESSION_ZSTD`, and `Redis::COMPRESSION_LZ4`.

<a name="interacting-with-redis"></a>
## Interacting With Redis

Expand Down
4 changes: 2 additions & 2 deletions releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ For LTS releases, such as Laravel 9, bug fixes are provided for 2 years and secu
| 6 (LTS) | 7.2 - 8.0 | September 3rd, 2019 | January 25th, 2022 | September 6th, 2022 |
| 7 | 7.2 - 8.0 | March 3rd, 2020 | October 6th, 2020 | March 3rd, 2021 |
| 8 | 7.3 - 8.1 | September 8th, 2020 | July 26th, 2022 | January 24th, 2023 |
| 9 (LTS) | 8.0 - 8.1 | January 25th, 2022 | January 30th, 2024 | January 28th, 2025 |
| 10 | 8.0 - 8.1 | January 24th, 2023 | July 30th, 2024 | January 28th, 2025 |
| 9 (LTS) | 8.0 - 8.1 | February 8th, 2022 | February 8th, 2024 | February 8th, 2025 |
| 10 | 8.0 - 8.1 | February 7th, 2023 | August 7th, 2024 | February 7th, 2025 |

<div class="sm:flex dark:text-gray-400 mb-1">
<div class="flex items-center mr-4">
Expand Down
13 changes: 13 additions & 0 deletions routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- [Named Routes](#named-routes)
- [Route Groups](#route-groups)
- [Middleware](#route-group-middleware)
- [Controllers](#route-group-controllers)
- [Subdomain Routing](#route-group-subdomain-routing)
- [Route Prefixes](#route-group-prefixes)
- [Route Name Prefixes](#route-group-name-prefixes)
Expand Down Expand Up @@ -324,6 +325,18 @@ To assign [middleware](/docs/{{version}}/middleware) to all routes within a grou
});
});

<a name="route-group-controllers"></a>
### Controllers

If a group of routes all utilize the same [controller](/docs/{{version}}/controllers), you may use the `controller` method to define the common controller for all of the routes within the group. Then, when defining the routes, you only need to provide the controller method that they invoke:

use App\Http\Controllers\OrderController;

Route::controller(OrderController::class)->group(function () {
Route::get('/orders/{id}', 'show');
Route::post('/orders', 'store');
});

<a name="route-group-subdomain-routing"></a>
### Subdomain Routing

Expand Down
10 changes: 8 additions & 2 deletions validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ Below is a list of all available validation rules and their function:
[In Array](#rule-in-array)
[Integer](#rule-integer)
[IP Address](#rule-ip)
[MAC Address](#rule-mac)
[JSON](#rule-json)
[Less Than](#rule-lt)
[Less Than Or Equal](#rule-lte)
Expand Down Expand Up @@ -1207,6 +1208,11 @@ The field under validation must be an IPv4 address.

The field under validation must be an IPv6 address.

<a name="rule-mac"></a>
#### mac_address

The field under validation must be a MAC address.

<a name="rule-json"></a>
#### json

Expand Down Expand Up @@ -1582,11 +1588,11 @@ Sometimes you may want to validate a field based on another field in the same ne
],
];

$validator->sometimes('channels.*.address', 'email', function($input, $item) {
$validator->sometimes('channels.*.address', 'email', function ($input, $item) {
return $item->type === 'email';
});

$validator->sometimes('channels.*.address', 'url', function($input, $item) {
$validator->sometimes('channels.*.address', 'url', function ($input, $item) {
return $item->type !== 'email';
});

Expand Down

0 comments on commit 4356a4b

Please sign in to comment.