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

arcmax's avatar
Level 1

Method App\Livewire\ListStudents::index does not exist.

New to larvel was trying out a video tutorial...and i got stuck in this basic thing... not too sure what i am doing wrong ...

web.php

use App\Livewire\ListStudents; use Illuminate\Support\Facades\Route; use App\Http\Controllers\ProfileController;

Route::get('/', function () { return view('welcome'); });

Route::middleware('auth')->group(function () {

Route::get('/students',[ListStudents::class,'index'])->name('students');

});

require DIR.'/auth.php';

ListStudents.php

namespace App\Livewire;

use App\Models\Student; use Livewire\Attributes\Layout; use Livewire\Component;

class ListStudents extends Component {

#[Layout(name: "layouts.app")]
public function render()
{
    return view('livewire.list-students',data: [
        'students'=> Student::all(),
    ]);
}

}

i have tried

Route::get('/students',[ListStudents::class,'index'])->name('students.index'); Route::get('/students',[ListStudents::class,'index']);

keeps giving me this ERROR:

BadMethodCallException - Method App\Livewire\ListStudents::index does not exist.

according to the original code in the video

Route::get('/students',[ListStudents::class])->name('students.index');

give me this error

ReflectionException - Function () does not exist

what am i doing wrong ? have i setup my project wrong ? the authorization seems to work well (using starter kit).

using laravel 11 and livewire 3

0 likes
1 reply

Please or to participate in this conversation.