33 lines
869 B
PHP
Executable File
33 lines
869 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Livewire;
|
|
|
|
use App\Models\Promociones;
|
|
use App\Models\Role;
|
|
use App\Models\Servicio;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Livewire\Component;
|
|
|
|
class ShowIndex extends Component
|
|
{
|
|
|
|
public function render()
|
|
{
|
|
$promociones = Promociones::where('visible','true')->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,
|
|
]);
|
|
}
|
|
}
|