update docs cross links

This commit is contained in:
2026-02-15 08:09:32 +03:00
parent b15d29f8e9
commit 7a6b13b12d
42 changed files with 241 additions and 101 deletions

View File

@@ -5,7 +5,19 @@ weight: 1
In this quickstart, we'll guide you through the most important functionalities of the package and how to use them.
First, you should [install the package](/docs/laravel-data/v4/installation-setup).
## Table of Contents
- [Using requests](#using-requests)
- [Casting data](#casting-data)
- [Customizing the creation of a data object](#customizing-the-creation-of-a-data-object)
- [Nesting data objects and arrays of data objects](#nesting-data-objects-and-arrays-of-data-objects)
- [Usage in controllers](#usage-in-controllers)
- [Using transformers](#using-transformers)
- [Generating a blueprint](#generating-a-blueprint)
- [Lazy properties](#lazy-properties)
- [Conclusion](#conclusion)
First, you should [install the package](../installation-setup.md).
We will create a blog with different posts, so let's start with the `PostData` object. A post has a title, some content, a status and a date when it was published:
@@ -189,7 +201,7 @@ As you can see, we're missing the `date` rule on the `published_at` property. By
- `array` when a property type is `array`
- `enum:*` when a property type is a native enum
You can read more about the process of automated rule generation [here](/docs/laravel-data/v4/as-a-data-transfer-object/request-to-data-object#content-automatically-inferring-rules-for-properties-1).
You can read more about the process of automated rule generation [here](../as-a-data-transfer-object/request-to-data-object.md#content-automatically-inferring-rules-for-properties-1).
We can easily add the date rule by using an attribute to our data object:
@@ -232,7 +244,7 @@ array:4 [
]
```
There are [tons](/docs/laravel-data/v4/advanced-usage/validation-attributes) of validation rule attributes you can add to data properties. There's still much more you can do with validating data objects. Read more about it [here](/docs/laravel-data/v4/as-a-data-transfer-object/request-to-data-object#validating-a-request).
There are [tons](../advanced-usage/validation-attributes.md) of validation rule attributes you can add to data properties. There's still much more you can do with validating data objects. Read more about it [here](../as-a-data-transfer-object/request-to-data-object.md#validating-a-request).
Tip: By default, when creating a data object in a non request context, no validation is executed:
@@ -275,7 +287,7 @@ It is possible to define casts within the `data.php` config file. By default, th
This code means that if a class property is of type `DateTime`, `Carbon`, `CarbonImmutable`, ... it will be automatically cast.
You can create your own casts; read more about it [here](/docs/laravel-data/v4/advanced-usage/creating-a-cast).
You can create your own casts; read more about it [here](../advanced-usage/creating-a-cast.md).
### Local casts
@@ -356,7 +368,7 @@ class PostData extends Data
}
```
You can read more about casting [here](/docs/laravel-data/v4/as-a-data-transfer-object/casts).
You can read more about casting [here](../as-a-data-transfer-object/casts.md).
## Customizing the creation of a data object
@@ -406,7 +418,7 @@ class PostData extends Data
```
Magic creation methods allow you to create data objects from any type by passing them to the `from` method of a data
object, you can read more about it [here](/docs/laravel-data/v4/as-a-data-transfer-object/creating-a-data-object#content-magical-creation).
object, you can read more about it [here](../as-a-data-transfer-object/creating-a-data-object.md#content-magical-creation).
It can be convenient to transform more complex models than our `Post` into data objects because you can decide how a model
would be mapped onto a data object.
@@ -764,7 +776,7 @@ Which leads to the following JSON:
}
```
You can read more about transformers [here](/docs/laravel-data/v4/as-a-resource/transformers).
You can read more about transformers [here](../as-a-resource/transformers.md).
## Generating a blueprint
@@ -1010,19 +1022,19 @@ You can do quite a lot with lazy properties like including them:
- when they are requested in the URL query
- by default, with an option to exclude them
And a lot more. You can read all about it [here](/docs/laravel-data/v4/as-a-resource/lazy-properties).
And a lot more. You can read all about it [here](../as-a-resource/lazy-properties.md).
## Conclusion
So that's it, a quick overview of this package. We barely scratched the surface of what's possible with the package. There's still a lot more you can do with data objects like:
- [casting](/docs/laravel-data/v4/advanced-usage/eloquent-casting) them into Eloquent models
- [transforming](/docs/laravel-data/v4/advanced-usage/typescript) the structure to typescript
- [working](/docs/laravel-data/v4/as-a-data-transfer-object/collections) with `DataCollections`
- [optional properties](/docs/laravel-data/v4/as-a-data-transfer-object/optional-properties) not always required when creating a data object
- [wrapping](/docs/laravel-data/v4/as-a-resource/wrapping) transformed data into keys
- [mapping](/docs/laravel-data/v4/as-a-data-transfer-object/mapping-property-names) property names when creating or transforming a data object
- [appending](/docs/laravel-data/v4/as-a-resource/appending-properties) extra data
- [including](/docs/laravel-data/v4/as-a-resource/lazy-properties#content-using-query-strings) properties using the URL query string
- [casting](../advanced-usage/eloquent-casting.md) them into Eloquent models
- [transforming](../advanced-usage/typescript.md) the structure to typescript
- [working](../as-a-data-transfer-object/collections.md) with `DataCollections`
- [optional properties](../as-a-data-transfer-object/optional-properties.md) not always required when creating a data object
- [wrapping](../as-a-resource/wrapping.md) transformed data into keys
- [mapping](../as-a-data-transfer-object/mapping-property-names.md) property names when creating or transforming a data object
- [appending](../as-a-resource/appending-properties.md) extra data
- [including](../as-a-resource/lazy-properties.md#content-using-query-strings) properties using the URL query string
- [inertia](https://spatie.be/docs/laravel-data/v4/advanced-usage/use-with-inertia) support for lazy properties
- and so much more ... you'll find all the information here in the docs