Answers for "laravel array to string conversion"

PHP
10

laravel array to string conversion

$history = [];
foreach($array as $value){
   $array = [
       'value' => $value,
       'status_id' => 2
   ];
   array_push($history, $array);
}
Posted by: Guest on September-02-2021
0

array to string conversion in laravel controller

if(!empty($value))
                {
                    foreach ($value as $v) 
                    {   
                        $insert[] = ['name' => $v['name'], 'email' => $v['email'],'company_name' => $v['company_name'],'company_id' => $v['company_id'], 'emp_id' => $v['emp_id']];     
                         $role_id= $v['role_id'];
                         $name=$v['name'];
                         $email=$v['email'];
                         $emails[]=$v['email'];
                         $emp_id=$v['emp_id'];                      
                         $data = array( 'name' => $name,'email' => $email , 'emp_id' => $emp_id);
                         $roles[]= $v['role_id']; 

                    }
                }
            }

            if(!empty($insert))
            {
                 $inserted=User::insert($insert);
                 if($inserted)
                 {
                     $email_select=User::select('id')->whereIn('email',$emails)->where('company_id',Auth::user()->company_id)->orderBy('id','Asc')->get();
                    foreach ($email_select as $key => $idget) 
                    {
                        $getid[]=$idget->id;
                    }
                 }
                 $datas[]=['user_id' => $getid , 'role_id' => $roles];                  
                 $insert_role=DB::table('role_user')->insert($datas) ;
Posted by: Guest on August-28-2021

Code answers related to "laravel array to string conversion"

Browse Popular Code Answers by Language