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
CodePudding user response:
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';
}
CodePudding user response:
Please check your table spelling in model file.
It is given below
//Error Code:
protected $tabel = 'student_id';
//Correct Code:
protected $table = 'student_id';