Skip to content

Commit

Permalink
Requires upcoming Tall-forms v8
Browse files Browse the repository at this point in the history
  • Loading branch information
tanthammar committed Oct 5, 2021
1 parent 533800c commit 1bed0cd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"illuminate/pipeline": "^6.0 || ^7.0 || ^8.0",
"illuminate/support": "^6.0 || ^7.0 || ^8.0",
"laravel-shift/blueprint": "^1.20",
"tanthammar/tall-forms": "^7.9.3 || ^8.0 || dev-master"
"tanthammar/tall-forms": "^8.0 || dev-master"
},
"require-dev": {
"orchestra/testbench": "^4.0 || ^5.0 || ^6.0",
Expand Down
20 changes: 12 additions & 8 deletions stubs/class.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,44 @@ class DummyModelForm extends TallFormComponent
{
public function mount(?DummyModel $dummymodel)
{
//Gate::authorize()
$this->fill([
//Gate::authorize();
$this->mount_form($dummymodel); // $dummymodel from hereon, called $this->model
}

protected function formAttr(): array
{
return [
'formTitle' => 'Create & Edit DummyModel',
'wrapWithView' => true, //see https://github.com/tanthammar/tall-forms/wiki/installation/Wrapper-Layout
'showSave' => true,
'showReset' => true,
'showDelete' => $dummymodel->exists ? true : false, //see https://github.com/tanthammar/tall-forms/wiki/Form-Methods#delete
'showGoBack' => true,
]);
$this->mount_form($dummymodel); // $dummymodel from hereon, called $this->model
];
}


// REQUIRED, if you are creating a model with this form
public function onCreateModel($validated_data)
protected function onCreateModel($validated_data)
{
// create...
}

// OPTIONAL, method exists in tall-form component
public function onUpdateModel($validated_data)
protected function onUpdateModel($validated_data)
{
// update...
}

// OPTIONAL, method exists in tall-form component
public function onDeleteModel()
protected function onDeleteModel()
{
$dummymodel = $this->model;
// delete...
}


public function fields()
protected function fields()
{
return [
// fields...
Expand Down

0 comments on commit 1bed0cd

Please sign in to comment.