How can i achieve something like this?
public function getInformation($model) {
$result = $model::with(['province', 'city']);
if($model == 'App\Models\Business') {
$result->with(['businessProvince', 'businessCity']);
}
$result->get();
}
// call the function
$information->getInformation(\App\Models\Business::class);
i'm getting error
Object of class Illuminate\Database\Eloquent\Builder could not be converted to string
on the sample code above. Any suggestion is really appreciated.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2vqvft7
via IFTTT
Aucun commentaire:
Enregistrer un commentaire