'Error Laravel: Don't have view with extension blade: Call to undefined method
I create CRUD App, so far still good progress. When I want to make new page for EDIT, I got an error
BadMethodCallException
Call to undefined method App\Models\Student::id() (View:
/home/john/Documents/api4/api4/resources/views/welcome2.blade.php)
I do read at this page: Call to undefined method App\Models\Category::factory() laravel
I follow that advice, so I'm edit in file that contain
HasFactory;
but still error
I think, it not for my error or I just don't understand the solution.
this is my route
// Route for edit
Route::get('/editstudents/{id}', [StudentsController::class, 'editstudents'])-
>name('editstudents');
this is in the continue
use HasFactory;
protected $tabel = 'student_id';
}
I hope you help me to solve this. Thank's
Solution 1:[1]
I think you got some typo in your student model. Try to change this
use HasFactory;
protected $tabel = 'student_id';
}
To this code
use HasFactory;
protected $table = 'student_id';
}
Solution 2:[2]
Please check your table spelling in model file.
It is given below
//Error Code:
protected $tabel = 'student_id';
//Correct Code:
protected $table = 'student_id';
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mansjoer |
| Solution 2 | cursorrux |
