@extends('layouts.admin') @section('title', $package->exists ? 'Edit Package' : 'New Package') @section('heading', $package->exists ? 'Edit Package' : 'New Package') @section('subheading', $package->exists ? 'Changes apply to licenses generated from here on.' : 'Sets the term, cycle and price every license generated from it inherits.') @php // Seeds the shared field partial's Alpine state with exactly what the // server rendered into the inputs, so the two never disagree — including // after a validation bounce, where old() wins. $initial = [ 'id' => $package->id, 'name' => old('name', $package->name), 'duration_days' => old('duration_days', $package->duration_days) ?? '', 'price' => (string) old('price', $package->price ?? 0), 'billing_period' => old('billing_period', $package->billing_period ?? 'custom'), 'sort_order' => (int) old('sort_order', $package->sort_order ?? 0), 'is_active' => (bool) old('is_active', $package->is_active ?? true), ]; // Counted once: this drives the header line, the delete copy and whether // deleting is offered at all. $issued = $package->exists ? $package->licenses()->count() : 0; @endphp @section('content')
@if ($issued > 0) Not possible while licenses reference it. Deactivate it instead — it stops being offered without breaking the licenses already issued. @else Permanent. The package is not referenced by any license. @endif