php artisan make:model Note -m
php artisan make:controller NoteController --resource --model=Note
php artisan make:view note.index
php artisan make:factory NoteFactory --model=Note
php artisan migrate:fresh --seed
Route::resource('notes', NoteController::class);
This will generate all following
Route::get('/notes', [NoteController::class, 'index'])->name('notes.index'); // List all notes
Route::get('/notes/create', [NoteController::class, 'create'])->name('notes.create'); // Show form to create a new note
Route::post('/notes', [NoteController::class, 'store'])->name('notes.store'); // Store a new note
Route::get('/notes/{note}', [NoteController::class, 'show'])->name('notes.show'); // Show a specific note
Route::get('/notes/{note}/edit', [NoteController::class, 'edit'])->name('notes.edit'); // Show form to edit a specific note
Route::put('/notes/{note}', [NoteController::class, 'update'])->name('notes.update'); // Update a specific note
Route::delete('/notes/{note}', [NoteController::class, 'destroy'])->name('notes.destroy'); // Delete a specific note
return view('dashboard', [
'studentCount' => $studentCount,
'classCount' => $classCount,
'subjectCount' => $subjectCount,
]);
Route::middleware(['auth', 'verified'])->group(function () {
Route::resource('class', ClassController::class);
Route::resource('student', StudentController::class);
Route::resource('subject', SubjectController::class);
});
Hidden fields
Hidden fields are not returned by server. To implement this in Laravel, you can use the following code in your Model:
protected $hidden = [
'password',
'remember_token',
];