0
Long live,
I am using Laravel 5.1 and after submitting a form that has a collection of checkboxes
array:3 [▼
0 => "24"
1 => "26"
2 => "32"
]
I save the record and then enter the block of records into a related table
if( $auto->save() )
{
$extras = $request['extra'];
foreach( $extras as $extra)
{
$extra = new AutoExtras;
$extra->auto_id = $auto->id;
$extra->extra_id = $extra;
$extra->save();
}
}
This would be supposed to work however, creates the first record by placing the extra_id = 0 and gives the following error:
Errorexception in helpers.php line 685: Method App Autoextras::__toString() must Return a string value
What’s the matter?