diff --git a/composer.json b/composer.json index dedf551..53b1ce6 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/stubs/class.stub.php b/stubs/class.stub.php index 0d2c6f2..e11cf23 100644 --- a/stubs/class.stub.php +++ b/stubs/class.stub.php @@ -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...