CluPilotCloud/app/Livewire/Support.php

42 lines
1.5 KiB
PHP

<?php
namespace App\Livewire;
use App\Livewire\Concerns\ResolvesCustomer;
use App\Models\SupportRequest;
use Livewire\Attributes\Layout;
use Livewire\Component;
#[Layout('layouts.portal-app')]
class Support extends Component
{
use ResolvesCustomer;
public function render()
{
$customer = $this->customer();
$requests = $customer
? SupportRequest::query()
->where('customer_id', $customer->id)
->latest('created_at')
->limit(20)
->get()
: collect();
return view('livewire.support', [
'requests' => $requests,
'openCount' => $requests->filter(fn (SupportRequest $r) => $r->isOpen())->count(),
// The answers link into the panel where the panel can actually do
// the thing being asked about — an FAQ that only describes a button
// makes the reader hunt for it.
'faqs' => [
['q' => __('support.faq_q1'), 'a' => __('support.faq_a1'), 'to' => route('backups'), 'cta' => __('support.faq_to_backups')],
['q' => __('support.faq_q2'), 'a' => __('support.faq_a2'), 'to' => route('users'), 'cta' => __('support.faq_to_users')],
['q' => __('support.faq_q3'), 'a' => __('support.faq_a3'), 'to' => null, 'cta' => null],
['q' => __('support.faq_q4'), 'a' => __('support.faq_a4'), 'to' => route('billing'), 'cta' => __('support.faq_to_billing')],
],
]);
}
}