Created
July 25, 2022 02:12
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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