Skip to content

Commit 19ed1ab

Browse files
committed
fix: docs
1 parent 0eeee8a commit 19ed1ab

File tree

7 files changed

+368
-226
lines changed

7 files changed

+368
-226
lines changed

docs-v3/components/TheSidebar.vue

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,25 @@
88
:key="section.title"
99
class="space-y-2"
1010
>
11-
<h3 class="text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider">
11+
<button
12+
@click="toggleSection(section.title)"
13+
class="flex items-center justify-between w-full text-left text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider hover:text-gray-700 dark:hover:text-gray-300 transition-colors"
14+
>
1215
{{ section.title }}
13-
</h3>
14-
<ul class="space-y-1">
16+
<svg
17+
class="h-4 w-4 transition-transform duration-200"
18+
:class="{ 'rotate-180': isSectionCollapsed(section.title) }"
19+
fill="none"
20+
viewBox="0 0 24 24"
21+
stroke="currentColor"
22+
>
23+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
24+
</svg>
25+
</button>
26+
<ul
27+
v-show="!isSectionCollapsed(section.title)"
28+
class="space-y-1 transition-all duration-200"
29+
>
1530
<li v-for="item in section.items" :key="item.path">
1631
<NuxtLink
1732
:to="item.path"
@@ -59,10 +74,25 @@
5974
:key="section.title"
6075
class="space-y-2"
6176
>
62-
<h3 class="text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider">
77+
<button
78+
@click="toggleSection(section.title)"
79+
class="flex items-center justify-between w-full text-left text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider hover:text-gray-700 dark:hover:text-gray-300 transition-colors"
80+
>
6381
{{ section.title }}
64-
</h3>
65-
<ul class="space-y-1">
82+
<svg
83+
class="h-4 w-4 transition-transform duration-200"
84+
:class="{ 'rotate-180': isSectionCollapsed(section.title) }"
85+
fill="none"
86+
viewBox="0 0 24 24"
87+
stroke="currentColor"
88+
>
89+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
90+
</svg>
91+
</button>
92+
<ul
93+
v-show="!isSectionCollapsed(section.title)"
94+
class="space-y-1 transition-all duration-200"
95+
>
6696
<li v-for="item in section.items" :key="item.path">
6797
<NuxtLink
6898
:to="item.path"
@@ -92,6 +122,23 @@ const { navigationSections } = useNavigation()
92122
const isMobileMenuOpen = inject('isMobileMenuOpen', ref(false))
93123
const toggleMobileMenu = inject('toggleMobileMenu', () => {})
94124
125+
// Collapsible sections state
126+
const collapsedSections = ref<Set<string>>(new Set())
127+
128+
// Toggle section visibility
129+
const toggleSection = (sectionTitle: string) => {
130+
if (collapsedSections.value.has(sectionTitle)) {
131+
collapsedSections.value.delete(sectionTitle)
132+
} else {
133+
collapsedSections.value.add(sectionTitle)
134+
}
135+
}
136+
137+
// Check if section is collapsed
138+
const isSectionCollapsed = (sectionTitle: string) => {
139+
return collapsedSections.value.has(sectionTitle)
140+
}
141+
95142
// Check if current route is active
96143
const isActive = (path: string) => {
97144
return route.path === path || route.path.startsWith(path + '/')

docs-v3/composables/useNavigation.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ export const useNavigation = () => {
77
{ title: 'Quickstart', path: '/quickstart' }
88
]
99
},
10+
{
11+
title: 'Authentication',
12+
items: [
13+
{ title: 'Authentication', path: '/auth/authentication' },
14+
{ title: 'Authorization', path: '/auth/authorization' },
15+
{ title: 'Profile', path: '/auth/profile' }
16+
]
17+
},
1018
{
1119
title: 'API',
1220
items: [
@@ -22,14 +30,6 @@ export const useNavigation = () => {
2230
{ title: 'Validation Methods', path: '/api/validation-methods' }
2331
]
2432
},
25-
{
26-
title: 'Authentication',
27-
items: [
28-
{ title: 'Authentication', path: '/auth/authentication' },
29-
{ title: 'Authorization', path: '/auth/authorization' },
30-
{ title: 'Profile', path: '/auth/profile' }
31-
]
32-
},
3333
{
3434
title: 'Search',
3535
items: [

docs-v3/content/auth/authentication.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ category: Auth
55
position: 1
66
---
77

8-
Laravel Restify has the support for a facile authentication with [Laravel Sanctum](https://laravel.com/docs/sanctum#api-token-authentication).
8+
Laravel Restify supports easy authentication with [Laravel Sanctum](https://laravel.com/docs/sanctum#api-token-authentication).
99

1010
Now you can finally enjoy the auth setup (`register`, `login`, `forgot`, and `reset password`).
1111

@@ -21,8 +21,8 @@ php artisan restify:setup-auth
2121

2222
This command will:
2323

24-
- **ensures** that `Sanctum` is installed and configured as the authentication provider in the `config/restify.php` file
25-
- **appends** the `Route::restifyAuth();` line to the `routes/api.php` file to add the authentication routes
24+
- **Ensures** that `Sanctum` is installed and configured as the authentication provider in the `config/restify.php` file
25+
- **Appends** the `Route::restifyAuth();` line to the `routes/api.php` file to add the authentication routes
2626

2727
## Prerequisites
2828

@@ -36,7 +36,7 @@ Laravel 10 automatically ships with Sanctum, so you don't have to install it.
3636

3737
### Install sanctum
3838

39-
See the docs [here](https://laravel.com/docs/sanctum#installation). You don't need to add `\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,` in your `'api'` middleware group.
39+
See the documentation [here](https://laravel.com/docs/sanctum#installation). You don't need to add `\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,` to your `'api'` middleware group.
4040

4141
You only have to run these 3 commands:
4242

@@ -88,7 +88,7 @@ Restify provides you a simple way to add all of your auth routes prepared. Simpl
8888
Route::restifyAuth();
8989
```
9090

91-
And voilà, now you have auth routes ready to be used.
91+
And that's it! You now have authentication routes ready to use.
9292

9393
These are the default routes provided by restify:
9494

@@ -113,7 +113,7 @@ You can also pass an `actions` argument, which is an array of actions you want t
113113
Route::restifyAuth(actions: ['login', 'register']);
114114
```
115115

116-
By using the `actions` argument, only the specified routes will be registered. If no `actions` argument is passed, Restify will register all the routes by default.
116+
When using the `actions` argument, only the specified routes will be registered. If no `actions` argument is provided, Restify will register all routes by default.
117117

118118

119119
## Sanctum Middleware
@@ -160,7 +160,7 @@ curl -X POST "http://restify-app.test/api/login" \
160160
}'
161161
```
162162

163-
So you should see the response like this:
163+
You should see a response like this:
164164

165165
```json
166166
{
@@ -182,11 +182,11 @@ So you should see the response like this:
182182

183183
### Authorization
184184

185-
We will discuss the authorization in more details here [Authorization](/auth/authorization). But for now let's see a simple example.
185+
We will discuss authorization in more detail in the [Authorization](/auth/authorization) section. For now, let's see a simple example.
186186

187187
After a successful login, you will receive an authentication token. You should include this token as a `Bearer` token in the Authorization header for your subsequent API requests using [Postman](https://learning.postman.com/docs/sending-requests/authorization/#bearer-token), axios library, or cURL.
188188

189-
Here's an axios example for retrieving the user's profile with the generated token:
189+
Here's an Axios example for retrieving the user's profile with the generated token:
190190

191191
```js
192192
import axios from 'axios';
@@ -218,7 +218,7 @@ Replace `http://restify-app.test` with your actual domain and use the authentica
218218

219219
## Register
220220

221-
Let's see how to register a new user in the application. You can test the registration using Curl or Postman.
221+
Let's see how to register a new user in the application. You can test the registration using cURL or Postman.
222222

223223
Use the following endpoint for registration:
224224

@@ -237,7 +237,7 @@ And send this payload:
237237

238238
Note: Email and password fields are required.
239239

240-
Now, you can send a POST request with Curl:
240+
Now, you can send a POST request with cURL:
241241

242242
```shell
243243
curl -X POST "http://restify-app.test/api/register" \
@@ -299,7 +299,7 @@ MAIL_MAILER=log
299299

300300
This will log the email content to the `laravel.log` file, allowing you to see the password reset email without actually sending it.
301301

302-
Now, you can send a POST request with Curl:
302+
Now, you can send a POST request with cURL:
303303

304304
```shell
305305
curl -X POST "http://restify-app.test/api/forgotPassword" \
@@ -337,7 +337,7 @@ The payload should include the token and email received from the password reset
337337
"password_confirmation": "new_password"
338338
}
339339
```
340-
Now, you can send a POST request with Curl:
340+
Now, you can send a POST request with cURL:
341341

342342
```shell
343343
curl -X POST "http://restify-app.test/api/resetPassword" \
@@ -392,7 +392,7 @@ After running the command, the register controller will be published to your app
392392

393393
<alert type="warning">
394394

395-
Important Note: If you want to publish other actions in the future, you'll need to manually update the `routes/api.php` file before running the restify:auth command again. Remove any previously published Restify routes, and keep the `Route::restifyAuth();` line so that the new routes can be correctly published.
395+
**Important Note:** If you want to publish other actions in the future, you'll need to manually update the `routes/api.php` file before running the `restify:auth` command again. Remove any previously published Restify routes, and keep the `Route::restifyAuth();` line so that the new routes can be correctly published.
396396

397397
</alert>
398398

0 commit comments

Comments
 (0)