Code cracker
Code cracker

Reputation: 396

How to rectify Symfony\Component\Debug\Exception\FatalThrowableError error in laravel-6?

i am trying to create a notes(with title and body) that should be store in database for that i write some api (only valid user can able to create notes based on the token),i am able to get the token when successfully logged in , When i try to create a note it's throwing some error ,How to rectify that error please help me to fix this issue...

Error

Symfony\Component\Debug\Exception\FatalThrowableError Class 'Notes' not found in file /home/payarc/Desktop/newLaravel/app/Http/Controllers/NotesController.php on line 20

NotesController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Notes;
use App\Http\Controllers\Controller;


class NotesController extends Controller
{
    public function create_Note(Request $request)
    {
        $note=new Notes();
        
        $note->title=$request->input('title');
        $note->body=$request->input('body'); 
        $note->user_id = Auth()->id();         
        $note->save();
        return $note;
    }
}

Upvotes: 0

Views: 501

Answers (2)

user16784870
user16784870

Reputation:

You simply use for creating object of notes model like this

$note=new AppNotes();

Upvotes: -1

S N Sharma
S N Sharma

Reputation: 1526

Try to replace

use Notes;

with full path

use App\Models\Notes;

Upvotes: 2

Related Questions