Enforce authentication for payment methods

This commit is contained in:
Benjamin Beganović 2024-02-19 17:47:58 +01:00
parent 1cbb3b2d20
commit bf22bb9143

View File

@ -12,6 +12,7 @@
namespace App\Livewire\BillingPortal\Payments; namespace App\Livewire\BillingPortal\Payments;
use App\Livewire\BillingPortal\Authentication;
use Livewire\Component; use Livewire\Component;
use App\Models\Subscription; use App\Models\Subscription;
use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Cache;
@ -26,6 +27,12 @@ class Methods extends Component
public function mount(): void public function mount(): void
{ {
if (auth()->guard('contact')->guest()) {
$this->dispatch('purchase.forward', component: Authentication::class);
return;
}
$total = collect($this->context['products'])->sum('total_raw'); $total = collect($this->context['products'])->sum('total_raw');
$methods = auth()->guard('contact')->user()->client->service()->getPaymentMethods( $methods = auth()->guard('contact')->user()->client->service()->getPaymentMethods(