Laravel CRUD(Create Read Update and Delete) Notes

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…


This content originally appeared on DEV Community and was authored by kogena6100@aiworldx.com

Requirement for CRUD

  1. A controller
  2. A Model connected to a relevant table on database
  3. Views file for (creating form , for table to show students)
  4. Routes

1. First Step
Create a view for your create student form

  1. 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


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » Laravel CRUD(Create Read Update and Delete) Notes." kogena6100@aiworldx.com | Sciencx - Saturday September 28, 2024, https://www.scien.cx/2024/09/28/laravel-crudcreate-read-update-and-delete-notes/
HARVARD
kogena6100@aiworldx.com | Sciencx Saturday September 28, 2024 » Laravel CRUD(Create Read Update and Delete) Notes., viewed ,<https://www.scien.cx/2024/09/28/laravel-crudcreate-read-update-and-delete-notes/>
VANCOUVER
kogena6100@aiworldx.com | Sciencx - » Laravel CRUD(Create Read Update and Delete) Notes. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/28/laravel-crudcreate-read-update-and-delete-notes/
CHICAGO
" » Laravel CRUD(Create Read Update and Delete) Notes." kogena6100@aiworldx.com | Sciencx - Accessed . https://www.scien.cx/2024/09/28/laravel-crudcreate-read-update-and-delete-notes/
IEEE
" » Laravel CRUD(Create Read Update and Delete) Notes." kogena6100@aiworldx.com | Sciencx [Online]. Available: https://www.scien.cx/2024/09/28/laravel-crudcreate-read-update-and-delete-notes/. [Accessed: ]
rf:citation
» Laravel CRUD(Create Read Update and Delete) Notes | kogena6100@aiworldx.com | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.