Skip to content

Commit bdfbc46

Browse files
committed
feat: add automatic inertia props
1 parent 636178b commit bdfbc46

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/docs/frontend/inertia.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,28 @@ app()->inertia('/route', 'view', [
6161

6262
:::
6363

64+
::: details Automatic Props
65+
66+
By default, Leaf automatically passes in some useful props into your inertia views. These include:
67+
68+
- `auth`: The current auth context, including:
69+
- `user`: The currently authenticated user, or `null` if not authenticated.
70+
- `id`: The ID of the currently authenticated user, or `null` if not authenticated.
71+
- `errors`: Any authentication errors that might have occurred during login or registration.
72+
- `permissions`: The permissions of the currently authenticated user if in use.
73+
- `roles`: The roles of the currently authenticated user if in use.
74+
- `hasSubscription`: Whether the currently authenticated user has an active subscription if using Leaf's billing features.
75+
- `subscription`: The current subscription of the authenticated user if using Leaf's billing features.
76+
- `isOnTrial`: Whether the currently authenticated user is on a trial if using Leaf's billing features.
77+
- `flash`: The default flash message or `null` if none exists.
78+
- `session`: The current session data, excluding flash messages and hidden data.
79+
- `billing`: The billing context if using Leaf's billing features, including:
80+
- `tiers`: The available billing tiers.
81+
- `periods`: The available billing periods.
82+
- `_token`: The current CSRF token if CSRF protection is enabled.
83+
84+
:::
85+
6486
## Accessing data passed into views
6587

6688
In the example above, we passed in some data from our application into our inertia view. Remember, Inertia views can be React, Vue or Svelte files, and any data we pass in from our app can be accessed as a prop like this:

0 commit comments

Comments
 (0)