Question : string to array in laravel
Answered by : obnoxious-okapi-6pvbfdbm4q68
$explode_id = json_decode($request->data, true);
Source : https://stackoverflow.com/questions/43972688/string-to-array-conversion-in-php | Last Update : Sat, 31 Oct 20
Question : convert array to string laravel
Answered by : abs-zarzis
collect([1, 2, 3, 4, 5])->implode('-');
// '1-2-3-4-5'
/************** Or you can do ****************/
$arr = array('Hello','World!','Beautiful','Day!');
echo implode(" ",$arr);
//Hello World! Beautiful Day!
Source : https://stackoverflow.com/questions/55825283/how-to-convert-array-to-string-in-laravel | Last Update : Fri, 22 Apr 22
Question : array to string conversion in laravel
Answered by : you
$myArray = ['Hello', 'World', 'Laravel'];
$string = implode(', ', $myArray);
echo $string;
Source : | Last Update : Tue, 19 Sep 23
Question : laravel array to string conversion
Answered by : snippets
$history = [];
foreach($array as $value){ $array = [ 'value' => $value, 'status_id' => 2 ]; array_push($history, $array);
}
Source : | Last Update : Thu, 09 Sep 21
Question : array to string conversion in laravel controller
Answered by : foolish-fish-0k02xixrto6x
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) ;
Source : https://stackoverflow.com/questions/46173560/array-to-string-conversion-in-laravel-5-4-controllers | Last Update : Sat, 04 Sep 21