-
app/Http/Livewire/ActivationsComponent.php
Open in GitHubuse App\Models\License; use Livewire\Component; class ActivationsComponent extends Component { public $license; public function mount(License $license) { $this->license = $license; } public function delete(int $activationId) { $this->license->activations()->where('id', $activationId)->delete(); } public function render() { return view('front.pages.products.livewire.activations', [ 'activations' => $this->license->refresh()->activations, ]); } }
-
resources/views/front/pages/products/livewire/activations.blade.php
Open in GitHub<div class="markup-tables" wire:poll.5s> @if(count($activations)) <table class="my-4 text-xs"> <thead> <tr> <th>Name</th> <th colspan="2">Activated at</th> <th></th> </tr> </thead> @foreach($activations as $activation) <tr wire:key="{{ $activation->id }}"> <td>{{ $activation->name }}</td> <td>{{ $activation->created_at->format('Y-m-d') }}</td> <td>{{ $activation->created_at->format('H:i:s') }}</td> <td> <button wire:click="delete({{ $activation->id }})"class="link link-red">Delete</button> </td> </tr> @endforeach </table> @else <p class="text-xs text-gray">Product has not been activated.</p> @endif </div>
-
resources/views/front/pages/products/partials/purchasedLicense.blade.php
Open in GitHub// @if($license->supportsActivations()) <div class="mt-6"> <h4 class="title-subtext">Activations</h4> <livewire:activations :license="$license"/> </div> @endif //