Wednesday 19 October 2016

laravel - syntax error, unexpected 'firstOrCreate' (T_STRING), expecting variable (T_VARIABLE) or '$

Im getting this error when i try to do this:


  $additional_features = $request->input('additional_features');
foreach($additional_features as $additional_feature){
$data = [
'name' => $additional_feature
];
$additional = new Feature::firstOrCreate($data);
}

$additional_features is an array and i try to add that, so how many items i have in array i will have that many records.Any suggestion?

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...