*/ protected $data = []; /** * Set the data under validation. * * @param array $data */ public function setData(array $data): static { $this->data = $data; return $this; } /** * Run the validation rule. * * @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail */ public function validate(string $attribute, mixed $value, Closure $fail): void { // Check to see if any of the assign-ish fields are set if ((isset($this->data['assigned_to'])) || (isset($this->data['assigned_user'])) || (isset($this->data['assigned_location'])) || (isset($this->data['assigned_asset'])) || (isset($this->data['assigned_type']))) { if (($value) && ($label = Statuslabel::find($value)) && ($label->getStatuslabelType()!='deployable')) { $fail(trans('admin/hardware/form.asset_not_deployable')); } } } }