Skip to content

Commit fb08f92

Browse files
committed
fix conflicts
2 parents b1339c0 + 5098e26 commit fb08f92

8 files changed

+87
-22
lines changed

configuration.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -322,13 +322,11 @@ When accessing this hidden route, you will then be redirected to the `/` route o
322322

323323
By default, Laravel determines if your application is in maintenance mode using a file-based system. This means to activate maintenance mode, the `php artisan down` command has to be executed on each server hosting your application.
324324

325-
Alternatively, Laravel offers a cache-based method for handling maintenance mode. This method requires running the `php artisan down` command on just one server. To use this approach, modify the "driver" setting in the `config/app.php` file of your application to `cache`. Then, select a cache `store` that is accessible by all your servers. This ensures the maintenance mode status is consistently maintained across every server:
325+
Alternatively, Laravel offers a cache-based method for handling maintenance mode. This method requires running the `php artisan down` command on just one server. To use this approach, modify the maintenance mode variables in your application's `.env` file. You should select a cache `store` that is accessible by all of your servers. This ensures the maintenance mode status is consistently maintained across every server:
326326

327-
```php
328-
'maintenance' => [
329-
'driver' => 'cache',
330-
'store' => 'database',
331-
],
327+
```ini
328+
APP_MAINTENANCE_DRIVER=cache
329+
APP_MAINTENANCE_STORE=database
332330
```
333331

334332
<a name="pre-rendering-the-maintenance-mode-view"></a>

container.md

+2
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,8 @@ You can create your own contextual attributes by implementing the `Illuminate\Co
349349

350350
namespace App\Attributes;
351351

352+
use Attribute;
353+
use Illuminate\Contracts\Container\Container;
352354
use Illuminate\Contracts\Container\ContextualAttribute;
353355

354356
#[Attribute(Attribute::TARGET_PARAMETER)]

errors.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ During local development, you should set the `APP_DEBUG` environment variable to
3232
<a name="reporting-exceptions"></a>
3333
### Reporting Exceptions
3434

35-
In Laravel, exception reporting is used to log exceptions or send them to an external service [Sentry](https://github.com/getsentry/sentry-laravel) or [Flare](https://flareapp.io). By default, exceptions will be logged based on your [logging](/docs/{{version}}/logging) configuration. However, you are free to log exceptions however you wish.
35+
In Laravel, exception reporting is used to log exceptions or send them to an external service like [Sentry](https://github.com/getsentry/sentry-laravel) or [Flare](https://flareapp.io). By default, exceptions will be logged based on your [logging](/docs/{{version}}/logging) configuration. However, you are free to log exceptions however you wish.
3636

3737
If you need to report different types of exceptions in different ways, you may use the `report` exception method in your application's `bootstrap/app.php` to register a closure that should be executed when an exception of a given type needs to be reported. Laravel will determine what type of exception the closure reports by examining the type-hint of the closure:
3838

helpers.md

+16
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Laravel includes a variety of global "helper" PHP functions. Many of these funct
6666
[Arr::pull](#method-array-pull)
6767
[Arr::query](#method-array-query)
6868
[Arr::random](#method-array-random)
69+
[Arr::reject](#method-array-reject)
6970
[Arr::set](#method-array-set)
7071
[Arr::shuffle](#method-array-shuffle)
7172
[Arr::sort](#method-array-sort)
@@ -828,6 +829,21 @@ $items = Arr::random($array, 2);
828829
// [2, 5] - (retrieved randomly)
829830
```
830831

832+
<a name="method-array-reject"></a>
833+
#### `Arr::reject()` {.collection-method}
834+
835+
The `Arr::reject` method removes items from an array using the given closure:
836+
837+
use Illuminate\Support\Arr;
838+
839+
$array = [100, '200', 300, '400', 500];
840+
841+
$filtered = Arr::reject($array, function (string|int $value, int $key) {
842+
return is_string($value);
843+
});
844+
845+
// [0 => 100, 2 => 300, 4 => 500]
846+
831847
<a name="method-array-set"></a>
832848
#### `Arr::set()` {.collection-method}
833849

http-tests.md

+8
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,7 @@ Laravel's `Illuminate\Testing\TestResponse` class provides a variety of custom a
989989
[assertMovedPermanently](#assert-moved-permanently)
990990
[assertContent](#assert-content)
991991
[assertNoContent](#assert-no-content)
992+
[assertStreamed](#assert-streamed)
992993
[assertStreamedContent](#assert-streamed-content)
993994
[assertNotFound](#assert-not-found)
994995
[assertOk](#assert-ok)
@@ -1472,6 +1473,13 @@ Assert that the response has the given HTTP status code and no content:
14721473
$response->assertNoContent($status = 204);
14731474
```
14741475

1476+
<a name="assert-streamed"></a>
1477+
#### assertStreamed
1478+
1479+
Assert that the response was a streamed response:
1480+
1481+
$response->assertStreamed();
1482+
14751483
<a name="assert-streamed-content"></a>
14761484
#### assertStreamedContent
14771485

notifications.md

+22-14
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ use App\Notifications\InvoicePaid;
9999
$user->notify(new InvoicePaid($invoice));
100100
```
101101

102-
> [!NOTE]
102+
> [!NOTE]
103103
> Remember, you may use the `Notifiable` trait on any of your models. You are not limited to only including it on your `User` model.
104104
105105
<a name="using-the-notification-facade"></a>
@@ -124,7 +124,7 @@ Notification::sendNow($developers, new DeploymentCompleted($deployment));
124124

125125
Every notification class has a `via` method that determines on which channels the notification will be delivered. Notifications may be sent on the `mail`, `database`, `broadcast`, `vonage`, and `slack` channels.
126126

127-
> [!NOTE]
127+
> [!NOTE]
128128
> If you would like to use other delivery channels such as Telegram or Pusher, check out the community driven [Laravel Notification Channels website](http://laravel-notification-channels.com).
129129
130130
The `via` method receives a `$notifiable` instance, which will be an instance of the class to which the notification is being sent. You may use `$notifiable` to determine which channels the notification should be delivered on:
@@ -144,7 +144,7 @@ public function via(object $notifiable): array
144144
<a name="queueing-notifications"></a>
145145
### Queueing Notifications
146146

147-
> [!WARNING]
147+
> [!WARNING]
148148
> Before queueing notifications you should configure your queue and [start a worker](/docs/{{version}}/queues#running-the-queue-worker).
149149
150150
Sending notifications can take time, especially if the channel needs to make an external API call to deliver the notification. To speed up your application's response time, let your notification be queued by adding the `ShouldQueue` interface and `Queueable` trait to your class. The interface and trait are already imported for all notifications generated using the `make:notification` command, so you may immediately add them to your notification class:
@@ -337,7 +337,7 @@ class InvoicePaid extends Notification implements ShouldQueue
337337
}
338338
```
339339

340-
> [!NOTE]
340+
> [!NOTE]
341341
> To learn more about working around these issues, please review the documentation regarding [queued jobs and database transactions](/docs/{{version}}/queues#jobs-and-database-transactions).
342342
343343
<a name="determining-if-the-queued-notification-should-be-sent"></a>
@@ -417,14 +417,14 @@ public function toMail(object $notifiable): MailMessage
417417
}
418418
```
419419

420-
> [!NOTE]
420+
> [!NOTE]
421421
> Note we are using `$this->invoice->id` in our `toMail` method. You may pass any data your notification needs to generate its message into the notification's constructor.
422422
423423
In this example, we register a greeting, a line of text, a call to action, and then another line of text. These methods provided by the `MailMessage` object make it simple and fast to format small transactional emails. The mail channel will then translate the message components into a beautiful, responsive HTML email template with a plain-text counterpart. Here is an example of an email generated by the `mail` channel:
424424

425425
<img src="https://laravel.com/img/docs/notification-example-2.png">
426426

427-
> [!NOTE]
427+
> [!NOTE]
428428
> When sending mail notifications, be sure to set the `name` configuration option in your `config/app.php` configuration file. This value will be used in the header and footer of your mail notification messages.
429429
430430
<a name="error-messages"></a>
@@ -602,7 +602,7 @@ public function toMail(object $notifiable): MailMessage
602602
}
603603
```
604604

605-
> [!NOTE]
605+
> [!NOTE]
606606
> The `attach` method offered by notification mail messages also accepts [attachable objects](/docs/{{version}}/mail#attachable-objects). Please consult the comprehensive [attachable object documentation](/docs/{{version}}/mail#attachable-objects) to learn more.
607607
608608
When attaching files to a message, you may also specify the display name and / or MIME type by passing an `array` as the second argument to the `attach` method:
@@ -916,7 +916,7 @@ php artisan make:notifications-table
916916
php artisan migrate
917917
```
918918

919-
> [!NOTE]
919+
> [!NOTE]
920920
> If your notifiable models are using [UUID or ULID primary keys](/docs/{{version}}/eloquent#uuid-and-ulid-keys), you should replace the `morphs` method with [`uuidMorphs`](/docs/{{version}}/migrations#column-method-uuidMorphs) or [`ulidMorphs`](/docs/{{version}}/migrations#column-method-ulidMorphs) in the notification table migration.
921921
922922
<a name="formatting-database-notifications"></a>
@@ -939,18 +939,26 @@ public function toArray(object $notifiable): array
939939
}
940940
```
941941

942-
When the notification is stored in your application's database, the `type` column will be populated with the notification's class name. However, you may customize this behavior by defining a `databaseType` method on your notification class:
942+
When a notification is stored in your application's database, the `type` column will be set to the notification's class name by default, and the `read_at` column will be `null`. However, you can customize this behavior by defining the `databaseType` and `initialDatabaseReadAtValue` methods in your notification class:
943+
944+
use Illuminate\Support\Carbon;
943945

944946
```php
945947
/**
946948
* Get the notification's database type.
947-
*
948-
* @return string
949949
*/
950950
public function databaseType(object $notifiable): string
951951
{
952952
return 'invoice-paid';
953953
}
954+
955+
/**
956+
* Get the initial value for the "read_at" column.
957+
*/
958+
public function initialDatabaseReadAtValue(): ?Carbon
959+
{
960+
return null;
961+
}
954962
```
955963

956964
<a name="todatabase-vs-toarray"></a>
@@ -981,7 +989,7 @@ foreach ($user->unreadNotifications as $notification) {
981989
}
982990
```
983991

984-
> [!NOTE]
992+
> [!NOTE]
985993
> To access your notifications from your JavaScript client, you should define a notification controller for your application which returns the notifications for a notifiable entity, such as the current user. You may then make an HTTP request to that controller's URL from your JavaScript client.
986994
987995
<a name="marking-notifications-as-read"></a>
@@ -1323,7 +1331,7 @@ public function toSlack(object $notifiable): SlackMessage
13231331
"type": "plain_text",
13241332
"text": "Team Announcement"
13251333
}
1326-
},
1334+
},
13271335
{
13281336
"type": "section",
13291337
"text": {
@@ -1466,7 +1474,7 @@ class User extends Authenticatable
14661474
<a name="notifying-external-slack-workspaces"></a>
14671475
### Notifying External Slack Workspaces
14681476

1469-
> [!NOTE]
1477+
> [!NOTE]
14701478
> Before sending notifications to external Slack workspaces, your Slack App must be [distributed](#slack-app-distribution).
14711479
14721480
Of course, you will often want to send notifications to the Slack workspaces owned by your application's users. To do so, you will first need to obtain a Slack OAuth token for the user. Thankfully, [Laravel Socialite](/docs/{{version}}/socialite) includes a Slack driver that will allow you to easily authenticate your application's users with Slack and [obtain a bot token](/docs/{{version}}/socialite#slack-bot-scopes).

responses.md

+33
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,39 @@ Route::get('/users.json', function () {
400400
});
401401
```
402402

403+
<a name="event-streams"></a>
404+
#### Event Streams
405+
406+
The `eventStream` method may be used to return a server-sent events (SSE) streamed response using the `text/event-stream` content type. The `eventStream` method accepts a closure which should [yield](https://www.php.net/manual/en/language.generators.overview.php) responses to the stream as the responses become available:
407+
408+
```php
409+
Route::get('/chat', function () {
410+
return response()->eventStream(function () {
411+
$stream = OpenAI::client()->chat()->createStreamed(...);
412+
413+
foreach ($stream as $response) {
414+
yield $response->choices[0];
415+
}
416+
});
417+
});
418+
```
419+
420+
This event stream may be consumed via an [EventSource](https://developer.mozilla.org/en-US/docs/Web/API/EventSource) object by your application's frontend. The `eventStream` method will automatically send a `</stream>` update to the event stream when the stream is complete:
421+
422+
```js
423+
const source = new EventSource('/chat');
424+
425+
source.addEventListener('update', (event) => {
426+
if (event.data === '</stream>') {
427+
source.close();
428+
429+
return;
430+
}
431+
432+
console.log(event.data);
433+
})
434+
```
435+
403436
<a name="streamed-downloads"></a>
404437
#### Streamed Downloads
405438

strings.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ You may disable case sensitivity by setting the `ignoreCase` argument to `true`:
713713
```php
714714
use Illuminate\Support\Str;
715715

716-
$matches = Str::is('*.jpg', 'photo.JPG', ignoreCase: true);
716+
$matches = Str::is('*.jpg', 'photo.JPG', ignoreCase: true);
717717

718718
// true
719719
```

0 commit comments

Comments
 (0)