Turn Your Vehicle Into a Smart Earning Asset

While you’re not driving your car or bike, it can still be working for you. MOTOSHARE helps you earn passive income by connecting your vehicle with trusted renters in your city.

πŸš— You set the rental price
πŸ” Secure bookings with verified renters
πŸ“ Track your vehicle with GPS integration
πŸ’° Start earning within 48 hours

Join as a Partner Today

It’s simple, safe, and rewarding. Your vehicle. Your rules. Your earnings.

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.