DEV Community

Jorge Nunes
Jorge Nunes

Posted on

Laravel Telescope com inertia

Após segui a documentão do laravel telescope até , em um projeto com Inertia e Vue.js, precisamos configurar a rota no web, pois por padrão ele não espera que você tenha saído do ecossistema padrão do Laravel.

Então vamos:

  1. Verifiuqe no app/Http/Kernel.php se no array "web" importou o \Laravel\Telescope\Http\Middleware\Authorize::class;

  2. Crie o php artisan make:modal TelescopeEntrie;

  3. Crie na routa o direcionamento:

Route::get('/telescope', function () {
    return Inertia::render('Telescope', [
        'telescope' => Telescope::all(),
    ]);
});
Enter fullscreen mode Exit fullscreen mode
  1. crie sua Page|Component Vue para o dashboard do Telescope, eu criei no resources/js/Page/Telescope.vue:
<template>
    <div>
        <h1>Telescope Dashboard</h1>

        <ul>
            <li v-for="entry in telescope" :key="entry.id">
                <a href="{{ entry.url }}">{{ entry.name }}</a>
            </li>
        </ul>
    </div>
</template>

<script>
export default {
    props: {
        telescope: {
            type: Array,
            required: true,
        },
    },
};
</script>

Enter fullscreen mode Exit fullscreen mode

Se você seguiu a documentação do Laravel e fez a vinco, esse mini-tutorial o deixará capaz de acessar o Telescope em seu projeto Laravel, por exemplo: http://localhost:8000/telescope.

Finalizado! O objetivo aqui é apenas seguir além da documentação do Laravel Telescope e ajudar a usar também o Vue e o Inertia em seu projeto Laravel.

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay