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-2

How to implement CRUD functions in the Laravel PHP Framework?

In previous blog Part-1, We have seen that how we start to implement CRUD functions.

Step 12. Now, Go to app/Http/Controllers/CustomerServiceController.php. Here, we’ll see all predefined Crud function, so we have to write code only for CRUD to display view file in the browser within Create() function, and to insert data into the Mysql table within Store() function.

public function create()
    {
        return view('service.create');
    }
Code language: PHP (php)

Step 13. Go to routes/web.php file ,we have to define route of this all CustomerServiceController CRUD functions.

Route::resource('service','ServiceController');Code language: PHP (php)

Step 14. Go to app/Service.php. Now, we need to list all the properties we need in the $fillable array.

Step 15. Go to app/Http/Controllers/ServiceController.php file and write following codes within index() function.

 public function index()
    {
       $services = Service::all()->toArray();
        return view('service.index', compact('services'));
    }
Code language: PHP (php)

Step 16. To update Mysql table data, we have to make an edit link in resource/views/Service/ folder. So, create an index.blade.php file.

Step 17. Go to resources/views/Service folder and create edit.blade.php file. In this file, service data will be loaded.

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.