Skip to content

Commit

Permalink
Add in-valid class from livewire validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisThompsonTLDR committed Jun 5, 2020
1 parent 8971f00 commit 89704f0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/View/Components/Bs.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,14 @@ private function classes()
$this->inputClasses[] = $this->inputClass;
}

// validation errors
// validation errors in session
if (optional(optional(session()->get('errors'))->getBag('default'))->get($this->dotName)) {
$this->inputClasses[] = 'is-invalid';
}
// validation errors in livewire
if (optional(optional(view()->getShared()['errors'])->getBag('default'))->get($this->dotName)) {
$this->inputClasses[] = 'is-invalid';
}

if ($this->type === 'file') {
$this->inputClasses[] = 'custom-file-input';
Expand Down

0 comments on commit 89704f0

Please sign in to comment.