Route visualisation

Hi all,

This question might sounds stupid to some people, but I struggle with this basic question.
With normal Laravel/Blade approach, you would go to Route > Controller > View…
The View would extends the master view…
Now, how I see this with Livewire, that I go through
Route > Controller > View > Livewire component.

How I understand from the documentation, I have to still call the view from the controller and call the livewire component from the view blade file.
I don’t see anywhere in the Livewire’s documentation that I can extend the master blade. Right now my controller returns the blade view that extends the master blade and yields the livewire component in.

`

@extends('adminlte::page')

@section('content_wrap')
    @if(auth()->user()->is_admin)
        @livewire('create-category')
    @endif
@endsection

@section('content')
    @livewire('create-ticket')
@endsection`

I hope this is a very understandable explanation.
I maybe don’t see the forest behind a single tree, so I apologise, but all I can find online is todo apps with single page stuff…

Many thanks for your future input!

It looks like you are doing it correctly. It might be easier for you to think of a livewire component just like a partial that you stick where you need it. If you weren’t aware already, if the only thing the controller is doing is passing the view, you can skip the controller step using Route::view https://laravel.com/docs/6.x/routing#view-routes.

It is possible to bypass the controller and view by using livewire like a SPA, and your route would just be Route::livewire('/home', 'componentName'); which will load the livewire component into the default content section (if your view files are set up correctly). The docs about this: https://laravel-livewire.com/docs/spa-mode/

1 Like

Thank you!
It’s actually explains it in the SPA mode documentation. I guess I missed it when I read the entire docs in 1 go.