Skip to content

Commit

Permalink
textarea (kgrzelak#4)
Browse files Browse the repository at this point in the history
* gitignore

* update

* update

* update

* update

* update

* update

* update

* update

* form alias

* remove unused packages

* form select options

* textarea
  • Loading branch information
kgrzelak authored Jan 29, 2024
1 parent 11c6c98 commit 48a972d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions resources/views/textarea.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<textarea class="{{ $class }} @error($name) is-invalid @enderror" name="{{ $name }}" placeholder="{{ $placeholder }}" {{ $attributes }} {{ $required ? 'required' : '' }}>{{ old($name, $value) }}</textarea>
@error($name)
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
12 changes: 12 additions & 0 deletions src/Items/FormTextarea.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Kgrzelak\LaravelForm\Items;

class FormTextarea extends BaseItem
{
public function __construct ()
{
$this->class = config('laravel-form.textarea.class', 'form-control');
$this->viewName = 'textarea';
}
}
6 changes: 6 additions & 0 deletions src/LaravelForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Kgrzelak\LaravelForm\Items\FormInput;
use Kgrzelak\LaravelForm\Items\FormSelect;
use Kgrzelak\LaravelForm\Items\FormTextarea;

class LaravelForm
{
Expand All @@ -16,4 +17,9 @@ public static function select(): FormSelect
{
return new FormSelect();
}

public static function textarea(): FormTextarea
{
return new FormTextarea();
}
}

0 comments on commit 48a972d

Please sign in to comment.