i'm looking for away to see if the query 'id' has a folder with the same id as name in the file system, i did it but it will slow down the drive in the future with lots of files
$query = Model::all();
if(Input::get('field') == 'true'){
$filenames = scandir('img/folders');
$query->whereIn('id', $filenames);
}
as you can see this will scan and get names of all folders inside the 'folders' directory and create an array with it, now my app is going to have hundreds of thousands of folders in the future and i would like to resolve it before it happens, thanks for further help
ps: other propositions to do it differently are welcome