@php // Get project gallery and images from collection use Modules\CaseStudy\Entities\CaseStudy; use Modules\Project\Entities\Project; $posts = App\Post::all(); $case_studies = $posts->where('post_type', 'Modules\CaseStudy\Entities\CaseStudy'); if(isset($case_studies)) { $case_study = $case_studies->where('slug', $subitem->url)->first() ?? null; } $project = $posts->where('slug', $subitem->url)->first() ?? null; if(isset($project)) { $location = Project::find($project->post_id)->location ?? null; } @endphp