Skip to content

Commit f158219

Browse files
committed
feat: add 2.x docs to vitepress
1 parent c0da243 commit f158219

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+149
-336
lines changed

Diff for: .vuepress/2.0.js

-116
This file was deleted.

Diff for: docs/.vitepress/2.x.js

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
import prefix from './prefix';
2+
3+
export default (base) => [
4+
{
5+
text: 'Getting Started',
6+
collapsed: false,
7+
items: prefix(base, 'getting-started', [
8+
{text: 'Installation', link: ''},
9+
{text: 'Upgrade Guide', link: 'upgrade'},
10+
{text: 'Core Concepts', link: 'core-concepts'},
11+
{text: 'Directory Structure', link: 'directory-structure'},
12+
]),
13+
},
14+
{
15+
text: 'Tutorial',
16+
collapsed: true,
17+
items: prefix(base, 'tutorial', [
18+
{text: '1. Getting Started', link: ''},
19+
{text: '2. Models', link: '02-models'},
20+
{text: '3. Server and Schemas', link: '03-server-and-schemas'},
21+
{text: '4. Relationships', link: '04-relationships'},
22+
{text: '5. Creating Resources', link: '05-creating-resources'},
23+
{text: '6. Modifying Resources', link: '06-modifying-resources'},
24+
{text: '7. Deleting Resources', link: '07-deleting-resources'},
25+
{text: '8. Fetching Resources', link: '08-fetching-resources'},
26+
]),
27+
},
28+
{
29+
text: 'Servers',
30+
collapsed: false,
31+
items: prefix(base, 'servers', [
32+
{text: 'The Basics', link: ''},
33+
{text: 'Events', link: 'events'},
34+
]),
35+
},
36+
{
37+
text: 'Schemas',
38+
collapsed: false,
39+
items: prefix(base, 'schemas', [
40+
{text: 'The Basics', link: ''},
41+
{text: 'Identifier', link: 'identifier'},
42+
{text: 'Attributes', link: 'attributes'},
43+
{text: 'Relationships', link: 'relationships'},
44+
{text: 'Eager Loading', link: 'eager-loading'},
45+
{text: 'Sorting', link: 'sorting'},
46+
{text: 'Pagination', link: 'pagination'},
47+
{text: 'Filters', link: 'filters'},
48+
{text: 'Soft Deleting', link: 'soft-deleting'},
49+
]),
50+
},
51+
{
52+
text: 'Routing',
53+
collapsed: false,
54+
items: prefix(base, 'routing', [
55+
{text: 'Routing', link: ''},
56+
{text: 'Controllers', link: 'controllers'},
57+
{text: 'Writing Actions', link: 'writing-actions'},
58+
{text: 'Custom Actions', link: 'custom-actions'},
59+
]),
60+
},
61+
{
62+
text: 'Requests',
63+
collapsed: false,
64+
items: prefix(base, 'requests', [
65+
{text: 'The Basics', link: ''},
66+
{text: 'Authorization', link: 'authorization'},
67+
{text: 'JSON:API Compliance', link: 'compliance'},
68+
{text: 'Resources', link: 'resources'},
69+
{text: 'Query Parameters', link: 'query-parameters'},
70+
]),
71+
},
72+
{
73+
text: 'Responses',
74+
collapsed: false,
75+
items: prefix(base, 'responses', [
76+
{text: 'JSON:API Documents', link: ''},
77+
{text: 'Errors', link: 'errors'},
78+
]),
79+
},
80+
{
81+
text: 'API Resources',
82+
collapsed: true,
83+
items: prefix(base, 'resources', [
84+
{text: 'The Basics', link: ''},
85+
{text: 'Attributes', link: 'attributes'},
86+
{text: 'Relationships', link: 'relationships'},
87+
{text: 'Meta', link: 'meta'},
88+
{text: 'Links', link: 'links'},
89+
]),
90+
},
91+
{
92+
text: 'Digging Deeper',
93+
collapsed: false,
94+
items: prefix(base, 'digging-deeper', [
95+
{text: 'Artisan Console', link: 'artisan'},
96+
{text: 'Countable', link: 'countable'},
97+
{text: 'Localisation', link: 'localisation'},
98+
{text: 'Proxies', link: 'proxies'},
99+
{text: 'Non-Eloquent Models', link: 'non-eloquent'},
100+
{text: 'Polymorphic to Many', link: 'polymorphic-to-many'},
101+
]),
102+
},
103+
{
104+
text: 'Testing',
105+
collapsed: false,
106+
items: prefix(base, 'testing', [
107+
{text: 'Getting Started', link: ''},
108+
{text: 'Resources', link: 'resources'},
109+
{text: 'Relationships', link: 'relationships'},
110+
{text: 'Requests', link: 'requests'},
111+
{text: 'Assertions', link: 'assertions'},
112+
]),
113+
},
114+
];

Diff for: docs/.vitepress/config.mts

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {defineConfig} from 'vitepress';
22
import v4 from './4.x';
33
import v3 from './3.x';
4+
import v2 from './2.x';
45

56
// https://vitepress.dev/reference/site-config
67
export default defineConfig({
@@ -14,13 +15,15 @@ export default defineConfig({
1415
items: [
1516
{text: '4.x', link: '/4.x/'},
1617
{text: '3.x', link: '/3.x/'},
18+
{text: '2.x', link: '/2.x/'},
1719
],
1820
},
1921
],
2022

2123
sidebar: {
2224
'/4.x/': v4('/4.x'),
23-
'/3.x/': v4('/3.x'),
25+
'/3.x/': v3('/3.x'),
26+
'/2.x/': v2('/2.x'),
2427
},
2528

2629
socialLinks: [

Diff for: 2.0/digging-deeper/artisan.md renamed to docs/2.x/digging-deeper/artisan.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Artisan Console
22

3-
[[toc]]
4-
53
## Generators
64

75
Laravel JSON:API ships with a comprehensive set of generators, so that
@@ -150,7 +148,7 @@ php artisan jsonapi:schema posts --model="\App\Foo\Bar\BlogPost" --server=v1
150148
```
151149
:::
152150

153-
If you are generating a schema for a [multi-resource model](./proxies.md),
151+
If you are generating a schema for a [multi-resource model](proxies.md),
154152
you should use the `--proxy` option when creating a schema for a proxy class.
155153

156154
As with other commands, use the `--force` option if you need to overwrite

Diff for: 2.0/digging-deeper/countable.md renamed to docs/2.x/digging-deeper/countable.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Countable Relationships
22

3-
[[toc]]
4-
53
## Introduction
64

75
:::danger
@@ -37,7 +35,7 @@ which we have used to add this capability to Laravel JSON:API.
3735
## Countable Fields
3836

3937
This feature is-opt in, i.e. you must mark a relationship field as being
40-
*countable*. Any *to-many* [relationship fields](../schema/relationships.md)
38+
*countable*. Any *to-many* [relationship fields](../schemas/relationships.md)
4139
can be marked as countable by calling the `canCount()` method on the relationship.
4240
For example:
4341

@@ -139,7 +137,7 @@ class PostQuery extends ResourceQuery
139137
```
140138

141139
If you have a collection query class for a
142-
[polymorphic to-many](./polymorphic-to-many.md) relationship, you should use the
140+
[polymorphic to-many](polymorphic-to-many.md) relationship, you should use the
143141
`JsonApiRule::countableForPolymorph()` method instead.
144142

145143

Diff for: 2.0/digging-deeper/localisation.md renamed to docs/2.x/digging-deeper/localisation.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Localisation
22

3-
[[toc]]
4-
53
## Introduction
64

75
Our implementation allows you to localise the `title`, `detail` and `code`

Diff for: 2.0/digging-deeper/non-eloquent.md renamed to docs/2.x/digging-deeper/non-eloquent.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Non-Eloquent Resources
22

3-
[[toc]]
4-
53
## Introduction
64

75
Some application may have objects that are not Eloquent models, that need to be

Diff for: 2.0/digging-deeper/polymorphic-to-many.md renamed to docs/2.x/digging-deeper/polymorphic-to-many.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Polymorphic To-Many Relations
22

3-
[[toc]]
4-
53
## Introduction
64

75
Laravel JSON:API contains a `MorphToMany` relationship field, that allows you

Diff for: 2.0/digging-deeper/proxies.md renamed to docs/2.x/digging-deeper/proxies.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Multi-Resource Models
22

3-
[[toc]]
4-
53
## Introduction
64

75
When writing JSON:API servers, your server will typically map an Eloquent model

Diff for: 2.0/getting-started/core-concepts.md renamed to docs/2.x/getting-started/core-concepts.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Core Concepts
22

3-
[[toc]]
4-
53
## Servers
64

75
Your Laravel application can have any number of JSON:API compliant

Diff for: 2.0/getting-started/directory-structure.md renamed to docs/2.x/getting-started/directory-structure.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Directory Structure
22

3-
[[toc]]
4-
53
## Convention
64

75
Laravel JSON:API follows the principle of **"Convention is better than configuration"**.

Diff for: 2.0/getting-started/README.md renamed to docs/2.x/getting-started/index.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Installation
22

3-
[[toc]]
4-
53
## Requirements
64

75
- PHP - `^7.4` or `^8.0`.

Diff for: 2.0/getting-started/upgrade.md renamed to docs/2.x/getting-started/upgrade.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Upgrade Guide
22

3-
[[toc]]
4-
53
## Upgrading to 2.x from 1.x
64

75
Version 2.0 adds support for PHP 8.1, and supports both Laravel 8 and 9.

Diff for: 2.0/README.md renamed to docs/2.x/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ test driven development a breeze.
4141

4242
## Get Started
4343

44-
Get start by heading to the [installation guide.](./getting-started)
44+
Get start by heading to the [installation guide.](./getting-started/index.md)
4545

4646
Or if you're new to JSON:API or want a great intro the Laravel JSON:API, then
47-
try our [tutorial.](./tutorial)
47+
try our [tutorial.](./tutorial/index.md)

Diff for: 2.0/requests/authorization.md renamed to docs/2.x/requests/authorization.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Authorization
22

3-
[[toc]]
4-
53
## Introduction
64

75
Typically requests to your API will need to be authorized. Thankfully,

Diff for: 2.0/requests/compliance.md renamed to docs/2.x/requests/compliance.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# JSON:API Compliance
22

3-
[[toc]]
4-
53
## Content Negotiation
64

75
The JSON:API defines client and server responsibilities for negotiation

Diff for: 2.0/requests/README.md renamed to docs/2.x/requests/index.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# The Basics
22

3-
[[toc]]
4-
53
## Introduction
64

75
Laravel JSON:API makes extensive use of Laravel

0 commit comments

Comments
 (0)