You could try this,
$model = fetchContents('App\Database\Models\Documents');
function fetchContents($model)
{
return \App::make($model)->all();
// or
// if all models are in the same namespace, you could then just use just a model name in the function call
// and "hardcode" the namespace...
return \App::make('App\Database\Models\'.$model)->all();
// depending on where the fetchContents function is you might also be able to use
// $this->app->make('...
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community