I have the following route defined in my web.php, to return a list of my Excepcion records in DB:
use App\Excepcion;
use App\Http\Resources\Excepcion as ExcepcionResource;
(...)
Route::get('/list/excepciones', function () {
return ExcepcionResource::collection(Excepcion::where('active', '1'));
});
But I'm getting the following server error:
Call to undefined method Illuminate\Database\Eloquent\Builder::mapInto()
If I change it to Excepcion::all() it works just fine. So, I'm not sure why I cannot use a where condition nor a scope. How can I filter the results here?