Skip to content

Commit 0fb0d1a

Browse files
committed
feat: add route view docs
1 parent 8c207f6 commit 0fb0d1a

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

.vitepress/theme/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ export default {
1515
},
1616
Layout() {
1717
return h(DefaultTheme.Layout, null, {
18-
'layout-top': () =>
19-
h(defineAsyncComponent(() => import('./components/shared/Banner.vue'))),
18+
// 'layout-top': () =>
19+
// h(defineAsyncComponent(() => import('./components/shared/Banner.vue'))),
2020
'aside-ads-before' : () =>
2121
h(defineAsyncComponent(() => import('./components/shared/Paperplane.vue'))),
2222
// h(defineAsyncComponent(() => import('./components/shared/GPTLink.vue'))),

src/docs/routing/index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,19 @@ If your route has a name, you can navigate to it by passing the route name in an
181181
response()->redirect(['home']);
182182
```
183183

184+
## View routes <Badge text="NEW" type="tip" />
185+
186+
If your route needs to return a template without any logic, you can use the `view()` method. This method accepts two arguments:
187+
188+
- The route pattern
189+
- The view file to render
190+
191+
```php:no-line-numbers
192+
app()->view('/home', 'home');
193+
```
194+
195+
The `view()` method will look for the view file using whatever view engine you have set up in your app. For instance, if you have blade setup, it will look for a file called `home.blade.php`. The template location also depends on your view engine setup. If you are using Leaf MVC, it will look for the file in the `app/views` folder and will use blade as the view engine.
196+
184197
## Routing in Leaf MVC
185198

186199
Leaf MVC comes with an `app/routes` folder that organizes all your route files. The `app/routes/index.php` file is the entry point for all your routes and contains the setup for 404s, maintenance mode and other global route settings.

0 commit comments

Comments
 (0)