Skip to content

Commit a89581b

Browse files
Fix markdown formatting (#10259)
1 parent 7305647 commit a89581b

18 files changed

+88
-88
lines changed

Diff for: eloquent-mutators.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ $user = User::find(1);
6666
$firstName = $user->first_name;
6767
```
6868

69-
> [!NOTE]
69+
> [!NOTE]
7070
> If you would like these computed values to be added to the array / JSON representations of your model, [you will need to append them](/docs/{{version}}/eloquent-serialization#appending-values-to-json).
7171
7272
<a name="building-value-objects-from-multiple-attributes"></a>
@@ -280,7 +280,7 @@ $user->mergeCasts([
280280
]);
281281
```
282282

283-
> [!WARNING]
283+
> [!WARNING]
284284
> Attributes that are `null` will not be cast. In addition, you should never define a cast (or an attribute) that has the same name as a relationship or assign a cast to the model's primary key.
285285
286286
<a name="stringable-casting"></a>
@@ -710,7 +710,7 @@ $user->address->lineOne = 'Updated Address Value';
710710
$user->save();
711711
```
712712

713-
> [!NOTE]
713+
> [!NOTE]
714714
> If you plan to serialize your Eloquent models containing value objects to JSON or arrays, you should implement the `Illuminate\Contracts\Support\Arrayable` and `JsonSerializable` interfaces on the value object.
715715
716716
<a name="value-object-caching"></a>

Diff for: eloquent-relationships.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ public function largestOrder(): HasOne
442442
}
443443
```
444444

445-
> [!WARNING]
445+
> [!WARNING]
446446
> Because PostgreSQL does not support executing the `MAX` function against UUID columns, it is not currently possible to use one-of-many relationships in combination with PostgreSQL UUID columns.
447447
448448
<a name="converting-many-relationships-to-has-one-relationships"></a>
@@ -870,7 +870,7 @@ If you would like your intermediate table to have `created_at` and `updated_at`
870870
return $this->belongsToMany(Role::class)->withTimestamps();
871871
```
872872

873-
> [!WARNING]
873+
> [!WARNING]
874874
> Intermediate tables that utilize Eloquent's automatically maintained timestamps are required to have both `created_at` and `updated_at` timestamp columns.
875875
876876
<a name="customizing-the-pivot-attribute-name"></a>
@@ -988,7 +988,7 @@ class RoleUser extends Pivot
988988
}
989989
```
990990

991-
> [!WARNING]
991+
> [!WARNING]
992992
> Pivot models may not use the `SoftDeletes` trait. If you need to soft delete pivot records consider converting your pivot model to an actual Eloquent model.
993993
994994
<a name="custom-pivot-models-and-incrementing-ids"></a>
@@ -1318,7 +1318,7 @@ public function bestImage(): MorphOne
13181318
}
13191319
```
13201320

1321-
> [!NOTE]
1321+
> [!NOTE]
13221322
> It is possible to construct more advanced "one of many" relationships. For more information, please consult the [has one of many documentation](#advanced-has-one-of-many-relationships).
13231323
13241324
<a name="many-to-many-polymorphic-relations"></a>
@@ -1348,7 +1348,7 @@ taggables
13481348
taggable_type - string
13491349
```
13501350

1351-
> [!NOTE]
1351+
> [!NOTE]
13521352
> Before diving into polymorphic many-to-many relationships, you may benefit from reading the documentation on typical [many-to-many relationships](#many-to-many).
13531353
13541354
<a name="many-to-many-polymorphic-model-structure"></a>
@@ -1472,7 +1472,7 @@ $alias = $post->getMorphClass();
14721472
$class = Relation::getMorphedModel($alias);
14731473
```
14741474

1475-
> [!WARNING]
1475+
> [!WARNING]
14761476
> When adding a "morph map" to your existing application, every morphable `*_type` column value in your database that still contains a fully-qualified class will need to be converted to its "map" name.
14771477
14781478
<a name="dynamic-relationships"></a>
@@ -1491,7 +1491,7 @@ Order::resolveRelationUsing('customer', function (Order $orderModel) {
14911491
});
14921492
```
14931493

1494-
> [!WARNING]
1494+
> [!WARNING]
14951495
> When defining dynamic relationships, always provide explicit key name arguments to the Eloquent relationship methods.
14961496
14971497
<a name="querying-relations"></a>
@@ -1633,7 +1633,7 @@ $posts = Post::whereHas('comments', function (Builder $query) {
16331633
}, '>=', 10)->get();
16341634
```
16351635

1636-
> [!WARNING]
1636+
> [!WARNING]
16371637
> Eloquent does not currently support querying for relationship existence across databases. The relationships must exist within the same database.
16381638
16391639
<a name="inline-relationship-existence-queries"></a>
@@ -2041,7 +2041,7 @@ You may not always need every column from the relationships you are retrieving.
20412041
$books = Book::with('author:id,name,book_id')->get();
20422042
```
20432043

2044-
> [!WARNING]
2044+
> [!WARNING]
20452045
> When using this feature, you should always include the `id` column and any relevant foreign key columns in the list of columns you wish to retrieve.
20462046
20472047
<a name="eager-loading-by-default"></a>
@@ -2358,7 +2358,7 @@ $user->posts()->createManyQuietly([
23582358

23592359
You may also use the `findOrNew`, `firstOrNew`, `firstOrCreate`, and `updateOrCreate` methods to [create and update models on relationships](/docs/{{version}}/eloquent#upserts).
23602360

2361-
> [!NOTE]
2361+
> [!NOTE]
23622362
> Before using the `create` method, be sure to review the [mass assignment](/docs/{{version}}/eloquent#mass-assignment) documentation.
23632363
23642364
<a name="updating-belongs-to-relationships"></a>
@@ -2521,5 +2521,5 @@ class Comment extends Model
25212521
}
25222522
```
25232523

2524-
> [!WARNING]
2524+
> [!WARNING]
25252525
> Parent model timestamps will only be updated if the child model is updated using Eloquent's `save` method.

Diff for: eloquent-resources.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ php artisan make:resource UserCollection
4444
<a name="concept-overview"></a>
4545
## Concept Overview
4646

47-
> [!NOTE]
47+
> [!NOTE]
4848
> This is a high-level overview of resources and resource collections. You are highly encouraged to read the other sections of this documentation to gain a deeper understanding of the customization and power offered to you by resources.
4949
5050
Before diving into all of the options available to you when writing resources, let's first take a high-level look at how resources are used within Laravel. A resource class represents a single model that needs to be transformed into a JSON structure. For example, here is a simple `UserResource` resource class:
@@ -212,7 +212,7 @@ class UserCollection extends ResourceCollection
212212
<a name="writing-resources"></a>
213213
## Writing Resources
214214

215-
> [!NOTE]
215+
> [!NOTE]
216216
> If you have not read the [concept overview](#concept-overview), you are highly encouraged to do so before proceeding with this documentation.
217217
218218
Resources only need to transform a given model into an array. So, each resource contains a `toArray` method which translates your model's attributes into an API friendly array that can be returned from your application's routes or controllers:
@@ -283,7 +283,7 @@ public function toArray(Request $request): array
283283
}
284284
```
285285

286-
> [!NOTE]
286+
> [!NOTE]
287287
> If you would like to include relationships only when they have already been loaded, check out the documentation on [conditional relationships](#conditional-relationships).
288288
289289
<a name="writing-resource-collections"></a>
@@ -392,7 +392,7 @@ class AppServiceProvider extends ServiceProvider
392392
}
393393
```
394394

395-
> [!WARNING]
395+
> [!WARNING]
396396
> The `withoutWrapping` method only affects the outermost response and will not remove `data` keys that you manually add to your own resource collections.
397397
398398
<a name="wrapping-nested-resources"></a>
@@ -605,7 +605,7 @@ public function toArray(Request $request): array
605605

606606
Again, if the given condition is `false`, these attributes will be removed from the resource response before it is sent to the client.
607607

608-
> [!WARNING]
608+
> [!WARNING]
609609
> The `mergeWhen` method should not be used within arrays that mix string and numeric keys. Furthermore, it should not be used within arrays with numeric keys that are not ordered sequentially.
610610
611611
<a name="conditional-relationships"></a>

Diff for: eloquent-serialization.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
When building APIs using Laravel, you will often need to convert your models and relationships to arrays or JSON. Eloquent includes convenient methods for making these conversions, as well as controlling which attributes are included in the serialized representation of your models.
1515

16-
> [!NOTE]
16+
> [!NOTE]
1717
> For an even more robust way of handling Eloquent model and collection JSON serialization, check out the documentation on [Eloquent API resources](/docs/{{version}}/eloquent-resources).
1818
1919
<a name="serializing-models-and-collections"></a>
@@ -105,7 +105,7 @@ class User extends Model
105105
}
106106
```
107107

108-
> [!NOTE]
108+
> [!NOTE]
109109
> To hide relationships, add the relationship's method name to your Eloquent model's `$hidden` property.
110110
111111
Alternatively, you may use the `visible` property to define an "allow list" of attributes that should be included in your model's array and JSON representation. All attributes that are not present in the `$visible` array will be hidden when the model is converted to an array or JSON:

Diff for: eloquent.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
Laravel includes Eloquent, an object-relational mapper (ORM) that makes it enjoyable to interact with your database. When using Eloquent, each database table has a corresponding "Model" that is used to interact with that table. In addition to retrieving records from the database table, Eloquent models allow you to insert, update, and delete records from the table as well.
4646

47-
> [!NOTE]
47+
> [!NOTE]
4848
> Before getting started, be sure to configure a database connection in your application's `config/database.php` configuration file. For more information on configuring your database, check out [the database configuration documentation](/docs/{{version}}/database#configuration).
4949
5050
<a name="generating-model-classes"></a>
@@ -435,7 +435,7 @@ $flights = Flight::where('active', 1)
435435
->get();
436436
```
437437

438-
> [!NOTE]
438+
> [!NOTE]
439439
> Since Eloquent models are query builders, you should review all of the methods provided by Laravel's [query builder](/docs/{{version}}/queries). You may use any of these methods when writing your Eloquent queries.
440440
441441
<a name="refreshing-models"></a>
@@ -558,7 +558,7 @@ Similar to the `lazy` method, the `cursor` method may be used to significantly r
558558

559559
The `cursor` method will only execute a single database query; however, the individual Eloquent models will not be hydrated until they are actually iterated over. Therefore, only one Eloquent model is kept in memory at any given time while iterating over the cursor.
560560

561-
> [!WARNING]
561+
> [!WARNING]
562562
> Since the `cursor` method only ever holds a single Eloquent model in memory at a time, it cannot eager load relationships. If you need to eager load relationships, consider using [the `lazy` method](#chunking-using-lazy-collections) instead.
563563
564564
Internally, the `cursor` method uses PHP [generators](https://www.php.net/manual/en/language.generators.overview.php) to implement this functionality:
@@ -807,7 +807,7 @@ Flight::where('active', 1)
807807

808808
The `update` method expects an array of column and value pairs representing the columns that should be updated. The `update` method returns the number of affected rows.
809809

810-
> [!WARNING]
810+
> [!WARNING]
811811
> When issuing a mass update via Eloquent, the `saving`, `saved`, `updating`, and `updated` model events will not be fired for the updated models. This is because the models are never actually retrieved when issuing a mass update.
812812
813813
<a name="examining-attribute-changes"></a>
@@ -1012,7 +1012,7 @@ Flight::upsert([
10121012
], uniqueBy: ['departure', 'destination'], update: ['price']);
10131013
```
10141014

1015-
> [!WARNING]
1015+
> [!WARNING]
10161016
> All databases except SQL Server require the columns in the second argument of the `upsert` method to have a "primary" or "unique" index. In addition, the MariaDB and MySQL database drivers ignore the second argument of the `upsert` method and always use the "primary" and "unique" indexes of the table to detect existing records.
10171017
10181018
<a name="deleting-models"></a>
@@ -1049,7 +1049,7 @@ If you are utilizing [soft deleting models](#soft-deleting), you may permanently
10491049
Flight::forceDestroy(1);
10501050
```
10511051

1052-
> [!WARNING]
1052+
> [!WARNING]
10531053
> The `destroy` method loads each model individually and calls the `delete` method so that the `deleting` and `deleted` events are properly dispatched for each model.
10541054
10551055
<a name="deleting-models-using-queries"></a>
@@ -1067,7 +1067,7 @@ To delete all models in a table, you should execute a query without adding any c
10671067
$deleted = Flight::query()->delete();
10681068
```
10691069

1070-
> [!WARNING]
1070+
> [!WARNING]
10711071
> When executing a mass delete statement via Eloquent, the `deleting` and `deleted` model events will not be dispatched for the deleted models. This is because the models are never actually retrieved when executing the delete statement.
10721072
10731073
<a name="soft-deleting"></a>
@@ -1089,7 +1089,7 @@ class Flight extends Model
10891089
}
10901090
```
10911091

1092-
> [!NOTE]
1092+
> [!NOTE]
10931093
> The `SoftDeletes` trait will automatically cast the `deleted_at` attribute to a `DateTime` / `Carbon` instance for you.
10941094
10951095
You should also add the `deleted_at` column to your database table. The Laravel [schema builder](/docs/{{version}}/migrations) contains a helper method to create this column:
@@ -1258,7 +1258,7 @@ You may test your `prunable` query by executing the `model:prune` command with t
12581258
php artisan model:prune --pretend
12591259
```
12601260

1261-
> [!WARNING]
1261+
> [!WARNING]
12621262
> Soft deleting models will be permanently deleted (`forceDelete`) if they match the prunable query.
12631263
12641264
<a name="mass-pruning"></a>
@@ -1371,7 +1371,7 @@ class AncientScope implements Scope
13711371
}
13721372
```
13731373

1374-
> [!NOTE]
1374+
> [!NOTE]
13751375
> If your global scope is adding columns to the select clause of the query, you should use the `addSelect` method instead of `select`. This will prevent the unintentional replacement of the query's existing select clause.
13761376
13771377
<a name="applying-global-scopes"></a>
@@ -1628,7 +1628,7 @@ if ($post->author()->is($user)) {
16281628
<a name="events"></a>
16291629
## Events
16301630

1631-
> [!NOTE]
1631+
> [!NOTE]
16321632
> Want to broadcast your Eloquent events directly to your client-side application? Check out Laravel's [model event broadcasting](/docs/{{version}}/broadcasting#model-broadcasting).
16331633
16341634
Eloquent models dispatch several events, allowing you to hook into the following moments in a model's lifecycle: `retrieved`, `creating`, `created`, `updating`, `updated`, `saving`, `saved`, `deleting`, `deleted`, `trashed`, `forceDeleting`, `forceDeleted`, `restoring`, `restored`, and `replicating`.
@@ -1665,7 +1665,7 @@ class User extends Authenticatable
16651665

16661666
After defining and mapping your Eloquent events, you may use [event listeners](/docs/{{version}}/events#defining-listeners) to handle the events.
16671667

1668-
> [!WARNING]
1668+
> [!WARNING]
16691669
> When issuing a mass update or delete query via Eloquent, the `saved`, `updated`, `deleting`, and `deleted` model events will not be dispatched for the affected models. This is because the models are never actually retrieved when performing mass updates or deletes.
16701670
16711671
<a name="events-using-closures"></a>
@@ -1797,7 +1797,7 @@ public function boot(): void
17971797
}
17981798
```
17991799

1800-
> [!NOTE]
1800+
> [!NOTE]
18011801
> There are additional events an observer can listen to, such as `saving` and `retrieved`. These events are described within the [events](#events) documentation.
18021802
18031803
<a name="observers-and-database-transactions"></a>

Diff for: errors.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ When you register a custom exception reporting callback using the `report` metho
5858
})
5959
```
6060

61-
> [!NOTE]
61+
> [!NOTE]
6262
> To customize the exception reporting for a given exception, you may also utilize [reportable exceptions](/docs/{{version}}/errors#renderable-exceptions).
6363
6464
<a name="global-log-context"></a>
@@ -355,7 +355,7 @@ public function report(): bool
355355
}
356356
```
357357

358-
> [!NOTE]
358+
> [!NOTE]
359359
> You may type-hint any required dependencies of the `report` method and they will automatically be injected into the method by Laravel's [service container](/docs/{{version}}/container).
360360
361361
<a name="throttling-reported-exceptions"></a>

Diff for: events.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ class SendShipmentNotification
271271
}
272272
```
273273

274-
> [!NOTE]
274+
> [!NOTE]
275275
> Your event listeners may also type-hint any dependencies they need on their constructors. All event listeners are resolved via the Laravel [service container](/docs/{{version}}/container), so dependencies will be injected automatically.
276276
277277
<a name="stopping-the-propagation-of-an-event"></a>
@@ -452,7 +452,7 @@ class SendShipmentNotification implements ShouldQueueAfterCommit
452452
}
453453
```
454454

455-
> [!NOTE]
455+
> [!NOTE]
456456
> 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).
457457
458458
<a name="handling-failed-jobs"></a>
@@ -539,7 +539,7 @@ public function retryUntil(): DateTime
539539
#### Specifying Queued Listener Backoff
540540

541541
If you would like to configure how many seconds Laravel should wait before retrying a listener that has encountered an exception, you may do so by defining a `backoff` property on your listener class:
542-
542+
543543
```php
544544
/**
545545
* The number of seconds to wait before retrying the queued listener.
@@ -616,7 +616,7 @@ OrderShipped::dispatchIf($condition, $order);
616616
OrderShipped::dispatchUnless($condition, $order);
617617
```
618618

619-
> [!NOTE]
619+
> [!NOTE]
620620
> When testing, it can be helpful to assert that certain events were dispatched without actually triggering their listeners. Laravel's [built-in testing helpers](#testing) make it a cinch.
621621
622622
<a name="dispatching-events-after-database-transactions"></a>
@@ -847,7 +847,7 @@ Event::assertListening(
847847
);
848848
```
849849

850-
> [!WARNING]
850+
> [!WARNING]
851851
> After calling `Event::fake()`, no event listeners will be executed. So, if your tests use model factories that rely on events, such as creating a UUID during a model's `creating` event, you should call `Event::fake()` **after** using your factories.
852852
853853
<a name="faking-a-subset-of-events"></a>

0 commit comments

Comments
 (0)