Skip to content

Commit 2f51ce4

Browse files
committed
reusability
1 parent 6e8273b commit 2f51ce4

File tree

4 files changed

+25
-46
lines changed

4 files changed

+25
-46
lines changed

docs/fundamentals/write-operations/delete.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ This section provides examples of the following delete operations:
3030
- :ref:`Delete one document <laravel-fundamentals-delete-one>`
3131
- :ref:`Delete multiple documents <laravel-fundamentals-delete-many>`
3232

33+
.. include:: /includes/fundamentals/write-operations/sample-model-section.rst
34+
3335
.. _laravel-fundamentals-delete-one:
3436

3537
Delete One Document

docs/fundamentals/write-operations/insert.txt

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,7 @@ of the Schema Builder documentation.
3636
To learn more about Eloquent models in the {+odm-short+}, see the
3737
:ref:`laravel-eloquent-models` section.
3838

39-
.. _laravel-fundamentals-write-insert-model:
40-
41-
Sample Model
42-
~~~~~~~~~~~~
43-
44-
The insert operations in this guide reference the following Eloquent
45-
model class:
46-
47-
.. literalinclude:: /includes/fundamentals/write-operations/Concert.php
48-
:language: php
49-
:dedent:
50-
:caption: Concert.php
51-
52-
.. tip::
53-
54-
The ``$fillable`` attribute lets you use Laravel mass assignment for insert
55-
operations. To learn more about mass assignment, see
56-
:ref:`laravel-model-mass-assignment` in the Eloquent Model Class
57-
documentation.
58-
59-
The ``$casts`` attribute instructs Laravel to convert attributes to common
60-
data types. To learn more, see `Attribute Casting <https://laravel.com/docs/{+laravel-docs-version+}/eloquent-mutators#attribute-casting>`__
61-
in the Laravel documentation.
39+
.. include:: /includes/fundamentals/write-operations/sample-model-section.rst
6240

6341
Insert One Document
6442
-------------------

docs/fundamentals/write-operations/modify.txt

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,7 @@ This guide provides examples of the following update operations:
3737
- :ref:`Update or insert in a single operation <laravel-modify-documents-upsert>`
3838
- :ref:`Update arrays in a document <laravel-modify-documents-arrays>`
3939

40-
.. _laravel-fundamentals-write-modify-model:
41-
42-
Sample Model
43-
~~~~~~~~~~~~
44-
45-
The update operations in this guide reference the following Eloquent
46-
model class:
47-
48-
.. literalinclude:: /includes/fundamentals/write-operations/Concert.php
49-
:language: php
50-
:dedent:
51-
:caption: Concert.php
52-
53-
.. tip::
54-
55-
The ``$fillable`` attribute lets you use Laravel mass assignment for insert
56-
operations. To learn more about mass assignment, see
57-
:ref:`laravel-model-mass-assignment` in the Eloquent Model Class
58-
documentation.
59-
60-
The ``$casts`` attribute instructs Laravel to convert attributes to common
61-
data types. To learn more, see `Attribute Casting <https://laravel.com/docs/{+laravel-docs-version+}/eloquent-mutators#attribute-casting>`__
62-
in the Laravel documentation.
40+
.. include:: /includes/fundamentals/write-operations/sample-model-section.rst
6341

6442
.. _laravel-modify-documents-update-one:
6543

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Sample Model
2+
~~~~~~~~~~~~
3+
4+
The operations in this guide reference the following Eloquent
5+
model class:
6+
7+
.. literalinclude:: /includes/fundamentals/write-operations/Concert.php
8+
:language: php
9+
:dedent:
10+
:caption: Concert.php
11+
12+
.. tip::
13+
14+
The ``$fillable`` attribute lets you use Laravel mass assignment for insert
15+
operations. To learn more about mass assignment, see
16+
:ref:`laravel-model-mass-assignment` in the Eloquent Model Class
17+
documentation.
18+
19+
The ``$casts`` attribute instructs Laravel to convert attributes to common
20+
data types. To learn more, see `Attribute Casting <https://laravel.com/docs/{+laravel-docs-version+}/eloquent-mutators#attribute-casting>`__
21+
in the Laravel documentation.

0 commit comments

Comments
 (0)