company_id) ? Company::getIdForCurrentUser($this->company_id) : $this->company_id; if ($this->input('last_audit_date')) { try { $lastAuditDate = Carbon::parse($this->input('last_audit_date')); $this->merge([ 'last_audit_date' => $lastAuditDate->startOfDay()->format('Y-m-d H:i:s'), ]); } catch (InvalidFormatException $e) { // we don't need to do anything here... } } $this->merge([ 'asset_tag' => $this->asset_tag ?? Asset::autoincrement_asset(), 'company_id' => $idForCurrentUser, 'assigned_to' => $assigned_to ?? null, ]); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(): array { $rules = array_merge( (new Asset)->getRules(), parent::rules(), ); return $rules; } }