Skip to content

Instantly share code, notes, and snippets.

@NandoKstroNet
Created July 25, 2022 02:12
Show Gist options
  • Save NandoKstroNet/0b72f84437055678f1aabcd3fd2ad954 to your computer and use it in GitHub Desktop.
Save NandoKstroNet/0b72f84437055678f1aabcd3fd2ad954 to your computer and use it in GitHub Desktop.
Componente Cancelar Assinatura VideoFlix Laravel Mastery, curso de Laravel do Zero em https://laravelmastery.com.br
<div class="mr-4" x-data="">
<a href="#" @click="$event.preventDefault();
if(!confirm('Têm certeza que deseja cancelar sua Assinatura?')) { return false; }
else { $wire.cancelSubscription() }"
class="px-4 py-2 border-red-900 bg-red-400 hover:bg-red-800
transition ease-in-out duration-300 text-white font-bold rounded">Cancelar</a>
</div>
<div class="mx-4 mt-4 mb-8 w-full text-white flex items-center justify-between">
<div>
Assinatura:
<strong>
{!!auth()->user()->subscribed('default')
? '<span class="text-xl font-bold text-green-800">ATIVA</span>'
: '<span class="text-xl font-bold text-red-800">INATIVA</span>' !!}
</strong>
</div>
@livewire('subscriptions.customer.cancel-subscription')
</div>
<?php
public function cancelSubscription()
{
auth()->user()->subscription('default')->cancel();
$this->emit('subscriptionCancelled');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment