You could try something like this...
function toModel($modelName, $models)
{
Eloquent::unguard();
$collection = new Illuminate\Support\Collection;
foreach($models as $model) {
$newModel = new $modelName($model);
$newModel->exists = true;
$collection->push($newModel);
}
Eloquent::reguard();
return $collection;
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community