Introduction
The front end in LaunchStack it's built on inertiajs and vue 3.
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
Was this helpful?