This content originally appeared on DEV Community and was authored by kogena6100@aiworldx.com
Requirement for CRUD
- A controller
- A Model connected to a relevant table on database
- Views file for (creating form , for table to show students)
- Routes
1. First Step
Create a view for your create student form
- Route for the view you created in step 1
Route::get('create_student', function(){
return view("create_student");
});
3.Create a form in the create_student
The below form is submited on the route whose name is saveStudent and the route method is Post
<h1>This is a form for student</h1>
<form action="{{ route('saveStudent') }}" method="POST">
@csrf
<input type="text" name="student_name" placeholder="Enter your name">
<br><br>
<input type="email" name="student_email" placeholder="Enter your email">
<br><br>
<input type="password" name="student_password" placeholder="Enter your password">
<br><br>
<button type="submit">Submit</button>
</form>
4. Create the route for submitting form
The route method should post and its name should be saveStudent
Route::post('save_student', [StudentController::class, "saveMethod"])->name('saveStudent');
This content originally appeared on DEV Community and was authored by kogena6100@aiworldx.com

kogena6100@aiworldx.com | Sciencx (2024-09-28T17:37:32+00:00) Laravel CRUD(Create Read Update and Delete) Notes. Retrieved from https://www.scien.cx/2024/09/28/laravel-crudcreate-read-update-and-delete-notes/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.