limit(4)->get(); $this->rol_id = Role::where('nombre','cliente')->value('id'); $planes = Servicio::where('estado','activo')->withMax(['tarifas' => function ($query) { $query->where('rol_id', $this->rol_id); }],'valor')->withMin(['tarifas' => function ($query) { $query->where('rol_id', $this->rol_id); }],'valor')->get(); return view('livewire.show-index',[ 'planes' => $planes, 'promociones' => $promociones, ]); } }