Skip to content
Advertisement

Laravel eloquent model Class not found

This is my web.php in routes folder

Route::get('/task',function(){

        $task = AppTask::all();

        return view('task',['task' => $task]);
    });

This is my Task model, Task.php

<?php

namespace App;

use IlluminateDatabaseEloquentModel;

class Tasks extends Model
{
    //

}

I dont know why when i go /task , an error shown

Class ‘AppTask’ not found

Can someone help me? I am new to Laravel

Advertisement

Answer

Top of your web.php route file mention model

use AppTask;

and then use

Route::get('/task',function(){

        $task = AppTask::all();

        return view('task',['task' => $task]);
    });
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement