Have array which have key & value. The keys name are same database columns name.
Total of keys in an index is greater than 50.
So,not possible to save data one by one key like
$user = new User; $user->name = 'John'; .......... ....... .......so on $user->save();
Sample array:
Array
(
[name] => 'Amit',
[age] => 25,
[field1] => 'val1',
....
[field33] => 'how' ,
....
[field54] => 'sumit'
)
Now, my question is that how can i save data in an model using easiest process.
Info:
- Using laravel 5
Try:
$Plan=new Plans;
$Plan->fill( $array);
$Plan->save();
Note: I know that fill not working as it not defined at fillable variable of that model
fillableattribute?