0

estoy trabajando en un proyecto con laravel, livewaire y el paquete Tenancy for Laravel, hasta el momento tengo funcionando bien el tema de el registro de un nuevo tenant y el dominio, me funciona bien el login y registro en el tenant, pero estoy con un problema para trabajar con livewire en el tenant, no me funcionan las fucniones d elivewire en el tenant... Por ejemplo: Tengo una vista principal como plantilla para ala administracion desde el lado del tenant:

<!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', 'Nombre del Taller') }}</title>

    <link href="{{ asset('admin_template/sb-admin-2.css') }}" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link href="https://fonts.googleapis.com/css?family=Nunito:400,600|Open+Sans:400,600,700" rel="stylesheet">

    <link rel="stylesheet" href="{{ asset('admin_template/css/easion.css') }}">
    <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">

    @vite(['resources/css/app.css', 'resources/js/app.js'])



    @livewireStyles
</head>

<body>
    <div class="dash">
        <div class="dash-nav dash-nav-dark">
            <header>
                <a href="#!" class="menu-toggle">
                    <i class="fas fa-bars"></i>
                </a>
                <a href="{{ route('dashboard') }}" class="easion-logo"><i class="fas fa-sun"></i> <span>CLIENTE</span></a>
            </header>
            <nav class="dash-nav-list">
                <a href="{{ route('dashboard') }}" class="dash-nav-item">
                    <i class="fas fa-home"></i> Dashboard </a>

                <div class="dash-nav-dropdown ">
                    <a href="#!" class="dash-nav-item dash-nav-dropdown-toggle">
                        <i class="fas fa-cube"></i> Mantenedores </a>
                    <div class="dash-nav-dropdown-menu">
                        <a href="{{ route('mantenedores.mantenedor.general') }}" class="dash-nav-dropdown-item">Parametros Generales</a>

                        <a href="{{ route('mantenedores.horarios') }}" class="dash-nav-dropdown-item">Horarios Atención</a>
                        <a href="forms.html" class="dash-nav-dropdown-item">Forms</a>

                        <a href="stats.html" class="dash-nav-dropdown-item">Stats</a>
                        <a href="tables.html" class="dash-nav-dropdown-item">Tables</a>
                        <a href="typography.html" class="dash-nav-dropdown-item">Typography</a>
                        <a href="userinterface.html" class="dash-nav-dropdown-item">User Interface</a>
                    </div>
                </div>

                <div class="dash-nav-dropdown">
                    <a href="#!" class="dash-nav-item dash-nav-dropdown-toggle">
                        <i class="fas fa-info"></i> About </a>
                    <div class="dash-nav-dropdown-menu">
                        <a href="https://github.com/subet/easion" target="_blank" class="dash-nav-dropdown-item">GitHub</a>
                        <a href="https://usebootstrap.com/theme/easion" target="_blank" class="dash-nav-dropdown-item">UseBootstrap</a>
                        <a href="https://mudimedia.com" target="_blank" class="dash-nav-dropdown-item">Mudimedia Software</a>
                    </div>
                </div>

                <a href="{{ route('mantenedores.clientes') }}" class="dash-nav-item">
                    <i class="fas fa-home"></i> Clientes </a>
            </nav>
        </div>
        <div class="dash-app">
            <header class="dash-toolbar">
                <a href="#!" class="menu-toggle">
                    <i class="fas fa-bars"></i>
                </a>

                <div class="tools">

                   {{--  <a href="#!" class="tools-item">
                        <i class="fas fa-bell"></i>
                        <i class="tools-item-count">4</i>
                    </a> --}}
                    <div class="dropdown tools-item">
                        <a href="#" class="" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            <i class="fas fa-user"></i>
                        </a>
                        <div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenu1">
                            <a class="dropdown-item" href="#!">Profile</a>
                            <a class="dropdown-item" href="login.html">Logout</a>
                        </div>
                    </div>
                </div>
            </header>
            <main class="dash-content" class="antialised">
                <div class="container-fluid">
                    @yield('titulo')
                    <div>
                        {{ $slot }}
                    </div>

                </div>
            </main>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
    <script src="{{ asset('admin_template/js/easion.js')}}"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-0pUGZvbkm6XF6gxjEnlmuGrJXVbNuzT9qBBavbLwCsOGabYfZo0T0to5eqruptLy" crossorigin="anonymous"></script>


    @stack('scripts')

    @livewireScripts

    <x-livewire-alert::scripts />

</body>

</html>

luego para mostrar una vista y que tenga la estructura de la plantilla lo hago de esta manera, en este ejemplo muestro una tabla donde se van amostrar los registros de una tabla de mi bd tenant:

<div>



    <div class="row bg-white dark:bg-gray-800 overflow-hidden shadow-xl sm:rounded-lg p-3 mb-4">

        <div class="col-12">
            <div class="flex justify-between items-center">
                <h1>Clientes Registrados</h1>
            </div>
        <a href="{{ route('mantenedores.clientes.registrar') }}" >asasas</a>
        </div>

        <div class="col-lg-12 mt-8">
            <div class="table-responsive">
                <table class="table  " cellspacing="0">
                    <thead>
                    <tr>
                        <th style="width: 5%;">#</th>
                        <th style="width: 20%;">Dia(s)</th>
                        <th style="width: 20%;">Horario de Apertura</th>
                        <th style="width: 20%;">Horario de Cierre</th>
                        <th>Estado</th>
                        <th>Acciones</th>
                    </tr>
                    </thead>
                    <tbody>
                  {{--   @foreach ($horarios as $horario )
                        <tr>
                            <td>{{ $horario->id }}</td>
                            <td>{{ $horario->dia }}</td>
                            <td>{{ $horario->horario_apertura }}</td>
                            <td>{{ $horario->horario_cierre }}</td>
                            <td>   @if ($horario->status == 0)
                                <span class="bg-green-100 text-green-800 text-xs font-bold me-2 px-2.5 py-0.5 rounded dark:bg-gray-700 dark:text-green-400 border border-green-400">PUBLICADA</span>

                                @else
                                <span class="bg-red-100 text-red-800 text-xs font-bold me-2 px-2.5 py-0.5 rounded dark:bg-gray-700 dark:text-red-400 border border-red-400">NO PUBLICADA</span>
                                @endif
                            </td>
                            <td>


                                <button type="button" class="btn btn-sm btn-success " wire:click="editar({{ $horario->id }})">
                                    Editar
                                </button>


                            </td>
                        </tr>
                    @endforeach --}}
                    </tbody>
                </table>
            </div>
            {{-- {{ $opiniones->links() }} --}}
        </div>

    </div>
</div>

el problema es que si voy al link de la ruta de este boton: <a href="{{ route('mantenedores.clientes.registrar') }}" >asasas</a>

me muestra un formulario ya sin los estilos, pero independiente de eso al enviar el form no llega a la funcion del componente livewire, este es el formulario:

<form wire:submit.prevent="guardar">
    <div class="row">

        <div class="col-lg-3">
            <div class="form-group">
                <label for="rut_general"><small><strong>Nombre(s) *</strong></small></label>
                <input type="text" placeholder="Nombre(s) del Cliente" class="form-control" id="nombre" wire:model="nombre">
                @error('nombre') <span class="mt-1 text-red-500 text-sm">{{ $message }}</span> @enderror
            </div>
        </div>

        <div class="col-lg-3">
            <div class="form-group">
                <label for="ape_pat"><small><strong>Apellido Paterno *</strong></small></label>
                <input type="text" placeholder="Apellido Paterno" class="form-control" id="ape_pat" wire:model="ape_pat">
                @error('ape_pat') <span class="mt-1 text-red-500 text-sm">{{ $message }}</span> @enderror
            </div>
        </div>

        <div class="col-lg-3">
            <div class="form-group">
                <label for="ape_mat"><small><strong>Apellido Materno</strong></small></label>
                <input type="text" placeholder="Apellido Materno" class="form-control" id="ape_mat" wire:model="ape_mat">
            </div>
        </div>

        <div class="col-lg-3">
            <div class="form-group">
                <label for="rut"><small><strong>Rut *</strong></small></label>
                <input type="text" placeholder="N° de Rut" class="form-control" id="rut" wire:model="rut">
                @error('rut') <span class="mt-1 text-red-500 text-sm">{{ $message }}</span> @enderror
            </div>
        </div>

        <div class="col-lg-3">
            <div class="form-group">
                <label for="direccion"><small><strong>Dirección *</strong></small></label>
                <input type="text" placeholder="Dirección del Cliente" class="form-control" id="direccion" wire:model="direccion">
                @error('direccion') <span class="mt-1 text-red-500 text-sm">{{ $message }}</span> @enderror
            </div>
        </div>

        <div class="col-lg-3">
            <div class="form-group">
                <label for="comuna"><small><strong>Comuna *</strong></small></label>
                <input type="text" placeholder="Comuna o Ciudad" class="form-control" id="comuna" wire:model="comuna">
                @error('comuna') <span class="mt-1 text-red-500 text-sm">{{ $message }}</span> @enderror
            </div>
        </div>

        <div class="col-lg-3">
            <div class="form-group">
                <label for="telefono"><small><strong>Telefono *</strong></small></label>
                <input type="tel" placeholder="Telefono Principal de Contacto" class="form-control" id="telefono" wire:model="telefono">
                @error('telefono') <span class="mt-1 text-red-500 text-sm">{{ $message }}</span> @enderror
            </div>
        </div>

        <div class="col-lg-3">
            <div class="form-group">
                <label for="whatsapp"><small><strong>Whatsapp </strong></small></label>
                <input type="tel" placeholder="N° de whatsapp Contacto" class="form-control" id="whatsapp" wire:model="whatsapp">
            </div>
        </div>
    </div>

    <div class="row">


        <div class="col-lg-3">
            <div class="form-group">
                <label for="email"><small><strong>Correo Electronico</strong></small></label>
                <input type="email" placeholder="Correo Electronico de Contacto" class="form-control" id="email" wire:model="email">
                @error('email') <span class="mt-1 text-red-500 text-sm">{{ $message }}</span> @enderror
            </div>
        </div>
    </div>
    <br>
    <div class="row">
        <div class="col-lg-12">
            <button class="btn btn-sm btn-success">Registrar Cliente</button>
        </div>

    </div>


</div>
</form>

este es el componente donde esta la funcion:

<?php

    namespace App\Http\Livewire\Tentants\Clientes;
    
    use App\Models\TCliente;
    use Livewire\Component;
    use Jantinnerezo\LivewireAlert\LivewireAlert;
    
    
    class Test extends Component
    {
    
        use LivewireAlert;
    
        public $nombre;
        public $ape_pat;
        public $ape_mat;
    
        public $rut;
        public $direccion;
        public $comuna;
        public $telefono;
        public $whatsapp;
        public $email;
        public $status = 0;
    
        protected $rules =[
            'nombre' => 'required',
            'ape_pat' => 'required',
            'rut' => 'required',
            'direccion' => 'required',
            'comuna' => 'required',
            'telefono' => 'required',
            'email' => 'required',
    
        ];
    
        protected $messages =[
            'nombre.required' => 'Este Campo es Requerido',
            'rut.required' => 'Este Campo es Requerido',
            'ape_pat.required' => 'Este Campo es Requerido',
            'direccion.required' => 'Este Campo es Requerido',
            'comuna.required' => 'Este Campo es Requerido',
            'telefono.required' => 'Este Campo es Requerido',
            'email.required' => 'Este Campo es Requerido',
    
        ];
    
       public function render()
        {
            return view('livewire.tentants.clientes.test');
        }
    
    
        public function guardar(){
            //$this->validate();
    
            dd($this->nombre);
            $cliente = TCliente::create([
                    'nombre' => $this->nombre,
                    'ape_pat' => $this->ape_pat,
                    'ape_mat' => $this->ape_mat,
                    'rut' => $this->rut,
                    'telefono' => $this->telefono,
                    'whatsapp' => $this->whatsapp,
                    'email' => $this->email,
                    'direccion' => $this->direccion,
                    'comuna' => $this->comuna,
                    'status' => $this->status,
            ]);
    
            $this->emit('actualizarTabla'); //Evento Actualizacion Tabla
    
            //Sweatalert
            $this->flash('success', 'Cliente Registrado con Exito', ['position' => 'top-end', 'timer' => '2500',
            'toast' => true,
            'timerProgressBar' => true]);
    
            //Redireccion
            return redirect()->route('mantenedores.clientes');
    
        }
    }

en consola no veo ningun error, solo noto que en la url al presionar el boton enviar se coloca un ? al final

Agardezco desde ya si alguien ha trabajado con estas tecnologias y tuvo un problema similar me pueda orientar un poco

0

Examina otras preguntas con la etiqueta o formula tu propia pregunta.