-
app/Rules/MatchingLicense.php
Open in GitHubuse App\Models\Activation; use App\Models\License; use Illuminate\Contracts\Validation\Rule; class MatchingLicense implements Rule { public function passes($attribute, $licenseKey) { if (! $license = License::firstWhere('key', $licenseKey)) { return false; } return $license->activations()->where('id', $this->activation->id)->exists(); } }
-
app/Http/Api/Requests/Activations/ShowActivationRequest.php
Open in GitHubuse App\Rules\MatchingLicense; use Illuminate\Foundation\Http\FormRequest; class ShowActivationRequest extends FormRequest { public function rules() { return [ 'license_key' => ['required', new MatchingLicense($this->activation)], ]; } }
-
resources/views/components/field.blade.php
Open in GitHub<div class="grid row-gap-2"> {{ $slot }} </div>