Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

spatie/spatie.be

493 stars
3 code files
View spatie/spatie.be on GitHub

app/Http/Livewire/ActivationsComponent.php

Open in GitHub
use 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
 
// ...

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.