This question already has an answer here:
- Call Laravel model by string 5 answers
I am trying to call a Model dynamically, but I am getting ..
Class 'xxx' not found
Here's my code:
use App\xxx;
.
.
.
$model = ucfirst(explode('_', $title)[0]);
$model::where('name', 'john')->get()->toArray();
dd($model) gives:
"xxx"
</div>