Kaydarin
Kaydarin

Reputation: 291

Fatal error: Class not found Laravel on routes

I'm new on Laravel and currently messing around the Laravel's quickstart sample project. There're list of records on tasks.blade.php, then each record will have a link to view them at tasksdetails.blade.php. I have pointed the URL via routes.php, but it shows a failure message:-

Class not found

Here's part of the associated code:-

Route::get('/taskdetails/{id}', function ($id) {
        return view('tasksdetails', [
        'tasksdetails' => TaskDetails::orderBy('created_at', 'asc')->get()
        ]);
    });

So, I wonder what does that mean? Did I miss some of the crucial step? Do I need to create a related class, if so, where & how am I going to do it?

Upvotes: 2

Views: 905

Answers (1)

Achraf Khouadja
Achraf Khouadja

Reputation: 6279

just do this,

Route::get('/taskdetails/{id}', function ($id) {
        return view('tasksdetails', [
        'tasksdetails' => App\TaskDetails::orderBy('created_at', 'asc')->get()
        ]);
    });

Upvotes: 3

Related Questions