50 lines
1.2 KiB
PHP
50 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire\Guest;
|
|
|
|
use App\Models\ServiceCategory;
|
|
use Livewire\Component;
|
|
use App\Models\Setting;
|
|
use App\Models\Service;
|
|
use Masmerise\Toaster\Toaster;
|
|
|
|
class LandingPage extends Component
|
|
{
|
|
public $settings = [];
|
|
public $services = [];
|
|
public $selectedService = null;
|
|
public $showModal = false; // Properti pengontrol modal secara aman
|
|
|
|
public function mount()
|
|
{
|
|
$this->settings = Setting::pluck('value', 'key')->toArray();
|
|
$this->services = ServiceCategory::with('services')->get();
|
|
}
|
|
|
|
public function showServiceDetail($id)
|
|
{
|
|
// Memuat service lengkap beserta kategori pendukungnya
|
|
$this->selectedService = Service::with('category')->find($id);
|
|
|
|
if ($this->selectedService) {
|
|
$this->showModal = true;
|
|
}
|
|
}
|
|
|
|
public function closeModal()
|
|
{
|
|
$this->selectedService = null;
|
|
$this->showModal = false;
|
|
}
|
|
|
|
public function copyAddress()
|
|
{
|
|
Toaster::success('Alamat berhasil disalin!');
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.guest.landing-page')
|
|
->layout('components.guest-layout');
|
|
}
|
|
} |