public function muid($muId) { $records = PathRecord::with('series.facets')->whereHas('series', function ($q) use($muId) { $q->whereMuId($muId); })->get(); $export = array(); foreach ($records as $record) { if (strpos($record->path, '/Manga/') === 0) { // Skip paths if (strpos($record->path, '/Manga/Non-English') === 0) { continue; } else { $path = $record->getPath(); if ($path->exists()) { $export[] = $record->toArray(); } } } } return Response::json(array('result' => true, 'data' => $export)); }