php - Cannot save data in more than one array in Laravel -
i trying save data in laravel has multiple arrays.
the array looks this:
array ( [0] => array ( [client_personnel_name] => ron [client_id] => 52 [client_personnel_email] => abc@gmail.com ) [1] => array ( [client_personnel_name] => john [client_id] => 52 [client_personnel_email] => abc@gmail.com ) )
when save data:
$personnel = clientspersonnel::create($client_personnel); $personnel->save();
on debugging data being created insert. in attributes sent data stored
[attributes:protected] => array ( [updated_at] => 2015-04-23 06:53:05 [created_at] => 2015-04-23 06:53:05 [id] => 2 )
how can save data has multiple arrays?
you can use db::insert()
, this:
db::table('client_personnel')->insert(array($client_personnel));
as alternative, using loop like.
foreach ($personnels $personnelattributes) { $personnel = new clientspersonnel($personnelattributes); $personnel->save(); }
regards,