Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours scrolling social media and waste money on things we forget, but won’t spend 30 minutes a day earning certifications that can change our lives.
Master in DevOps, SRE, DevSecOps & MLOps by DevOpsSchool!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

How to implement CRUD functions in the Laravel PHP Framework? Part-3

How to implement CRUD functions in the Laravel PHP Framework?

In previous blog Part-2, We have seen create() store() and index() functions.

Step 18. Go to app/Http/Controller/CustomerServiceController.php and in that we have to write code within edit() method and update(). Here edit() method will load edit form view file in browser and update() will update edit view file form data.

 public function edit($id)
    {
         $service = Service::where('service_id',$id)->first();
       return view('service.edit', compact('service'));
    }Code language: PHP (php)

Step 19. To Delete data first we have to make delete URL in resources/views/Service/index.blade.php.

Step 20. To Delete particular service data based on the value of id which has passed in delete link form. Write the following code within the destroy() method.

public function destroy($id)
    {
        $service = Service::where('service_id', $id);
        $service->delete();
        return redirect()->route('service.index')->with('success', 'Data Deleted');
    }Code language: PHP (php)

Now, we can add, edit and delete Customer Service Data

Thanks

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.