Support the ongoing development of →
posted 8 years ago
Last updated 2 years ago.

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!


Your banner here too?

VenomRush venomrush Joined 27 May 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.