Introduction

The front end in LaunchStack it's built on inertiajsarrow-up-right and vue 3arrow-up-right.

How it works

Inertiajs it's an interface between the backend (Laravel) and the frontend framework (vue), example of sending data from controller to view:

use Inertia\Inertia;
use App\Models\Post;

class PostsController extends Controller
{
    public function index()
    {
        $posts = Post::latest()->paginate(10);
        
        return Inertia::render('Posts/Index', [
            'posts' => $posts
        ]);
    }
}

Posts/Index.vue

<script setup>
const { posts } = defineProps({
    posts: Object,
});
</script>
<template>
    
    <div v-for="post in posts" :key="post">
        {{ post.title }}
    </div>
    
</template>

Last updated