-
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- New stubs, create.stub and update.stub
- Fix for checkboxes, automatically becomes array data - **Breaking change:** Deleted mount() from form component - **Breaking change:** renamed setup() to afterFormProperties() - New LegacyForm trait to cover for breaking changes - New Relationship field type support - New Custom field type support - New custom() field type support - Updated make command to support multiple stub files - New DefaultMount trait for slim components
- Loading branch information
1 parent
05d5d14
commit 75d9a6a
Showing
10 changed files
with
167 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace App\Http\Livewire\Namespace; | ||
|
||
use App\ModelsPathDummyModel; | ||
use Tanthammar\TallForms\ArrayField; | ||
use Tanthammar\TallForms\Field; | ||
use Tanthammar\TallForms\FormComponent; | ||
use Tanthammar\TallForms\Traits\DefaultMount; | ||
|
||
class DummyComponent extends FormComponent | ||
{ | ||
public function mount() | ||
{ | ||
//Gate::authorize() | ||
$this->fill([ | ||
'formTitle' => FormTitle, | ||
'action' => 'create', | ||
'spaMode' => true, //wrap with x-pages.default | ||
'showGoBack' => false, //or true | ||
]); | ||
$this->mount_form(); | ||
} | ||
|
||
|
||
public function create($form_data) | ||
{ | ||
DummyModel::create($form_data); | ||
} | ||
|
||
public function fields() | ||
{ | ||
return [ | ||
Field::make('Name')->input()->rules('required'), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace App\Http\Livewire\Namespace; | ||
|
||
use App\ModelsPathDummyModel; | ||
use Tanthammar\TallForms\ArrayField; | ||
use Tanthammar\TallForms\Field; | ||
use Tanthammar\TallForms\FormComponent; | ||
|
||
class DummyComponent extends FormComponent | ||
{ | ||
public function mount(DummyModel $dummymodel) | ||
{ | ||
//Gate::authorize() | ||
$this->fill([ | ||
'formTitle' => FormTitle, | ||
'action' => 'update', | ||
'spaMode' => true, //wrap with x-pages.default | ||
'showGoBack' => false, //or true | ||
]); | ||
|
||
$this->mount_form($dummymodel); | ||
} | ||
|
||
public function fields() | ||
{ | ||
return [ | ||
Field::make('Name')->input()->rules('required'), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
<x-tall-field-wrapper :inline="$field->inline" :colspan="$field->colspan" :field="$field->name" | ||
:label="$field->label" :labelW="$field->labelW" :fieldW="$field->fieldW"> | ||
@foreach($field->options as $value => $label) | ||
<x-tall-checkbox :field="$field->key" id="{{$field->name}}.{{$loop->index}}" :label="$label" | ||
:help="$field->help" :errorMsg="$field->errorMsg" :value="$value" /> | ||
<x-tall-checkbox field="{{$field->key}}" id="{{$field->name}}.{{$loop->index}}" :label="$label" :help="$field->help" :errorMsg="$field->errorMsg" :value="$value" /> | ||
@endforeach | ||
</x-tall-field-wrapper> | ||
</x-tall-field-wrapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Tanthammar\TallForms\Traits; | ||
|
||
/** | ||
* Optional default mount method if you want to keep your components slim | ||
* @package Tanthammar\TallForms\Traits | ||
*/ | ||
trait DefaultMount | ||
{ | ||
public function mount($model = null) | ||
{ | ||
$this->mount_form($model); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Tanthammar\TallForms\Traits; | ||
|
||
/** | ||
* Mount method from v1 | ||
* @package Tanthammar\TallForms\Traits | ||
*/ | ||
trait LegacyMount | ||
{ | ||
public function mount($model = null, $action = 'update', $showDelete = false) | ||
{ | ||
$this->model = $model; | ||
$this->beforeFormProperties(); | ||
$this->setFormProperties($this->model); | ||
$this->action = $action; | ||
$this->showDelete = $showDelete; | ||
$this->setup(); | ||
$this->previous = \URL::previous(); //used for saveAndGoBack | ||
} | ||
} |