Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/docs/cli/creating-an-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The Leaf CLI is a powerful tool and offers multiple ways to create a new Leaf ap
<VideoModal
buttonText="Leaf CLI walkthrough"
description="You can take a look at our leaf cli setup walkthrough on youtube."
videoUrl="https://www.youtube.com/embed/yb3LUYHtopQ"
videoUrl="https://www.youtube.com/embed/d3Y-aOPLf4c"
/>

## Basic Installation
Expand Down
2 changes: 1 addition & 1 deletion src/docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Leaf CLI is a command line tool that helps you create, manage and deploy Leaf ap
<VideoModal
buttonText="CLI installation walkthrough"
description="You can take a look at our leaf cli setup walkthrough on youtube."
videoUrl="https://www.youtube.com/embed/yb3LUYHtopQ"
videoUrl="https://www.youtube.com/embed/jqkear8zue8"
/>

*This guide will assume that your system meets all the [technical requirements](/docs/installation#technical-requirements).*
Expand Down
2 changes: 1 addition & 1 deletion src/docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ leaf serve
<VideoModal
buttonText="Setup a project via CLI"
subject="Watch the leaf installation walkthrough"
videoUrl="https://www.youtube.com/embed/PuOk5xqTIsA"
videoUrl="https://www.youtube.com/embed/d3Y-aOPLf4c"
/>

## Manual Installation
Expand Down
18 changes: 17 additions & 1 deletion src/docs/routing/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,18 @@

<!-- markdownlint-disable no-inline-html -->

<script setup>
import VideoModal from '@theme/components/shared/VideoModal.vue'
</script>

Routing is the foundation of every web application. It's the process of defining the URL structure of your application and how it responds to requests. Leaf comes with a powerful router that simplifies the way you define routes in your application. You can take routing as one fancy traffic officer that directs traffic to the right place.

<VideoModal
buttonText="Basic routing with Leaf"
description="In this video, we look at how to create routes for your Leaf application"
videoUrl="https://www.youtube.com/embed/BWWVR9bSiQ0"
/>

## Create a route

Every route has a URL (the web address the user visits) and an HTTP method (like GET, POST, etc.), which tells the server what action to take. For example, if you create a route for a GET request to `/home`, the user can access that page by visiting `http://example.com/home`. This way, different URLs and methods control how users interact with your app.
Expand Down Expand Up @@ -102,7 +112,13 @@ app()->run();

In big applications, you might have to reference a route over and over again. When you change the route URL, you'll have to change it everywhere you referenced it. To avoid this, you can name your routes and reference them by their name. This will save you a lot of time and prevent errors.

Leaf router allows you name routes by using route options. Route options allow you to configure a route in a more advanced way. You can set route options by passing an array with configuration options as the second argument to the whatever route you ar e wofking on.
Leaf router allows you name routes by using route params. They allow you add extra options to your routes like a route name, middleware, etc. You can set route options by passing an array with configuration options as the second argument to the whatever route you are working on.

<VideoModal
buttonText="Named routes in Leaf"
description="Route parameters help you define extra options for your application routes, let's take a look"
videoUrl="https://www.youtube.com/embed/_0B9Zoxgv64"
/>

```php
app()->get('/home', ['name' => 'home', function () {
Expand Down