laravellaravel-livewire

Livewire component not found even I already created


Component not found

resources/views/resetUserPassword.blade.php

@extends('layouts.admin')

@section('main-content')
     {{-- @include('livewire.reset-user-password') --}} <-- This is working
     <livewire:reset-user-password /> 
@endsection

@section('custom-section')
    @include('js.resetUserPasswordJSFn')
@endsection

resources/views/livewire/reset-user-password.blade.php

<div>
    <style type="text/css">

    </style>
    <!-- Loading Cover -->
    <div wire:loading wire:target="resetPassword" class="cover-spin" id="cover-spin">
    </div>
    <!-- Page Heading -->
    <div>
        <h3 class="mb-1 text-gray-800">{{ __('User Management > Reset Password') }}</h3>
        <br />
        <div id="uploadpdf" class="col-sm-12" style="margin-left: auto; margin-right: auto;">
            <div style="text-align: center">
                <label for="userId" style="text-align: center">User ID:<i style="color: red">*</i></label>
                <input class="col-sm-2" type="text" id="userId" wire:model.lazy="userId" />
            </div>

            <br />
            <div style="text-align: center" class="col-sm-12">
                <button style="text-align: right" type="button" class="btn btn-outline-warning" id="clearBtn" wire:click="clear">
                    {{ __('Clear') }}
                </button>
                <button style="text-align: right" type="submit" class="btn btn-outline-primary" id="submitBtn"
                    onclick="confirm('Confirm reset password?') || event.stopImmediatePropagation()" wire:click="resetPassword">
                    {{ __('Submit') }}
                </button>
            </div>
        </div>
    </div>

</div>

app/Http/Livewire/ResetUserPassword.php

<?php

namespace App\Http\Livewire;

use Livewire\Component;

class ResetUserPassword extends Component
{
    

    public function mount()
    {
        self::clear();
    }

    public function render()
    {
        return view("livewire.reset-user-password");
    }

}

app\Http\Controllers\ResetUserPasswordController.php

<?php

namespace App\Http\Controllers;

use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;

use Auth; 
use DateTime;

class ResetUserPasswordController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware("auth");
    }

    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */
    public function index()
    {
        //$users = User::count();

        return view("resetUserPassword");
    }
}

I would like to create the new livewire component but it still not rendering even the blade file already exists. May I ask what am I missing in order to render the component correctly?

I checked thoroughly the livewire component file exists but still not found so may need some help


Solution

  • In Livewire3, files are created in these two places. Not app/Http/Livewire/.

    Did you create the file manually?

    When creating a new component, use the make:livewire command.

    php artisan make:livewire ResetUserPassword