<?php

namespace App\Service;
use App\Models\ContactPerson;
use Log;
use Auth;

class ContactPersonService
{
    public function contactPersonCreateUpdate($request,$user){

        if(isset($request['contact_persons'])){

            foreach ($request['contact_persons'] as $key => $persons) {
                # code...
                
                $obj['salutation']=$persons['salutation'];
                $obj['first_name']=$persons['first_name'];
                $obj['last_name']=$persons['last_name'];
                $obj['mobile_no']=$persons['mobile_no'];
                $obj['email']=$persons['email'];
                $obj['work_phone']=$persons['work_phone'];
                $obj['designation']=$persons['designation'];
               
                $obj['user_id']=$user['id'];
    
                $address=ContactPerson::create($obj);

                $address->update();
               
            }
        }
            return true;
        
    }


}