Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

theUnforgiven's avatar

Imported at the top or web.php

use App\Http\Livewire\AddTask;
use App\Http\Livewire\Tasks;
use Illuminate\Support\Facades\Route;
Snapey's avatar

If it shows your form then the route is working.

I was just trying to clarify that you don't need to specify @render

theUnforgiven's avatar

If I put back the render

Route::get('', [Tasks::class, 'render']);
    Route::get('create', [AddTask::class, 'render']);

The form shows but the styling is missing now. as app-layout is commented out.

Snapey's avatar

Livewire will use the layouts.app.layout as the master layout. You don't need to refer to it again.

You also don't need to call render

here is a component I'm working on today

    use App\Http\Livewire\DolliesCounted;


    Route::get('/counts',DolliesCounted::class)->name('dolliescounted');

and then the view

<div wire:poll.120s >
    <x-slot name="header">
        <h2 class="text-xl font-semibold leading-tight text-gray-800">
            Dollies Counted
        </h2>
    </x-slot>
    <div class="py-2">
        <div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
            <div class="flex p-4 overflow-hidden bg-white shadow-xl sm:rounded-lg">
                <div class="w-1/3">Date:
                    <input type="date"  wire:model='datefilter' />
                </div>
                
                <div class="w-1/3">Depot:
                    <select wire:model='depot' class="px-2">
                        <option value="">All</option>
                        @foreach($depots as $depot)
                            <option value="{{ $depot->sitename }}">{{ ucfirst($depot->sitename) }}</option>
                        @endforeach
                    </select>
                </div>
                
                <div class="relative w-1/3">Filter:
                    <input wire:model.debounce.400ms='filter' class="px-2 border border-gray-300 rounded {{ $filter ? 'bg-yellow-200' : '' }}" />
                    @if($filter)
                        <svg wire:click='filterClear' class="inline-block w-4 -ml-6 text-gray-500 hover:text-red-700" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
                        </svg>
                    @endif
                </div>
                
            </div>
        </div>
    </div>

    <div class="py-2">
        <div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
            <div class="p-4 overflow-hidden bg-white shadow-xl sm:rounded-lg">

                <table class="w-full mb-2">
                    <thead>
                        <tr class="">
                            <th class="w-2/12 text-left">Depot</th>
                            <th class="w-2/12 text-left">Alias</th>
                            <th class="w-3/12 text-left">Driver</th>
                            <th class="w-2/12 text-left">Vehicle</th>
                            <th class="w-1/12 ">D In</th>
                            <th class="w-1/12 ">D Out</th>
                            <th class="w-1/12 ">D Rem</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach($journeys as $journey)
                        <tr class="cursor-pointer hover:bg-gray-100" wire:click="$emit('selectJourney',{{ $journey->id }})">
                            <td>{{ ucfirst($journey->depot) }}</td>
                            <td>{{ $journey->JourneyAlias }}</td>
                            <td>{{ strtoupper($journey->tasks->first()->driver ?? '-') }}</td>
                            <td>{{ $journey->tasks->first()->vehicle ?? '-' }}</td>
                            <td class="text-center">{{ $journey->counts->dollies_in }}</td>
                            <td class="text-center">{{ $journey->counts->dollies_out }}</td>
                            <td class="text-center">{{ $journey->counts->dollies_remain }}</td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>
                {{ $journeys->links() }}
            </div>
        </div>
    </div>

    @livewire('dollies-modal')
    
</div>

and relevant part of the render method;

        return view('livewire.dollies-counted')
            ->withJourneys($journeys)
            ->withDepots(Depot::all());
    }

theUnforgiven's avatar

I'm using Jetstream and removing the layout doesn't show any styles now either.

theUnforgiven's avatar

Commented out protected $namespace = 'App\Http\Controllers'; in RouteServiceProvider as Caleb shows in the v2 upgrade videos and renamed app.blade.php to app-layout.blade and now works.

Maybe this as been addressed in the latest version of Jetstream, but I'm using the version of when it was released.

2 likes
Snapey's avatar

I'm also using jetstream. This is my layouts/app.blade.php which as far as I can remember is untouched.


<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="csrf-token" content="{{ csrf_token() }}">

        <title>{{ config('app.name', 'Laravel') }}</title>

        <!-- Fonts -->
        <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap">

        <!-- Styles -->
        <link rel="stylesheet" href="{{ asset('css/app.css') }}">

        @livewireStyles

        <!-- Scripts -->
        <script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.js" defer></script>
    </head>
    <body class="font-sans antialiased">
        <div class="min-h-screen bg-gray-100">
            @livewire('navigation-dropdown')

            <!-- Page Heading -->
            <header class="bg-white shadow">
                <div class="px-4 py-6 mx-auto max-w-7xl sm:px-6 lg:px-8">
                    {{ $header }}
                </div>
            </header>

            <!-- Page Content -->
            <main>
                {{ $slot }}
            </main>
        </div>

        @stack('modals')

        @livewireScripts
    </body>
</html>


Livewire docs;

By default, Livewire will render the ShowPosts component into the {{ $slot }} of a blade layout component located at: resources/views/layouts/app.blade.php

So, no need for the x-app-layout in your component's view.

theUnforgiven's avatar

It's Laravel Framework 8.0.1, so I'm guessing this was all addressed then. Maybe I'll do a fresh install and see if it was just my version outdated slightly.

theUnforgiven's avatar

Ah that was changed 29 days ago according to Github so yeah that'll be it as I installed it a couple of days before then. So that would make sense.

I'm still going to install a fresh copy and see.

Randerscheinung's avatar

Hey i got the same error and fixed it by changing the Namespace in the RouteServiceProvider.php to this

protected string $moduleNamespace = 'Modules\Production\Http';

and then used namespace groups in web.php like so

    Route::namespace('Livewire')->group(function () {
        Route::get('/', Stanzerei\Select::class);
    });
    Route::namespace('Controllers')->group(function () {
        Route::get('/auth/login', 'ProductionAuthController@login')->name('production.auth.login');
        Route::post('/auth/login', 'ProductionAuthController@authenticateUser')->name('production.authenticate');
    });

of course i use Modules but maybe it helps someone.

Previous

Please or to participate in this conversation.