Skip to content

Commit

Permalink
fix: editing template items throws error (#201)
Browse files Browse the repository at this point in the history
* fix: editing template items throws error

* style: formatting

* fix: insights requirements fail
  • Loading branch information
64knl committed Feb 8, 2024
1 parent de626b5 commit 55ddf61
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions phpinsights.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
],
],
'requirements' => [
'min-quality' => 60,
'min-quality' => 59,
'min-complexity' => 60,
'min-architecture' => 55,
'min-style' => 80,
'min-architecture' => 58,
'min-style' => 86,
],
];
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ public function readOne(Template $table, TemplateItem $tableItem)

$widgetPage->widget->addForm($form);

$widgetPage->widget->addWidget(CmsEditorImportExportController::getExport([$tableItem]));

return $widgetPage->response();
}

Expand Down Expand Up @@ -98,6 +96,10 @@ public function update(FormDataRequest $request, Template $table, TemplateItem $
$tableItem->server_properties = $fieldProperties->updateServerProperties($tableItem->type, $request);

$tableItem->save();

// Write changes to file
$table->exportToFile();

$response = new LayoutResponse();
$response->addAction(new Toast('Field properties updated'));
$response->addAction(new Redirect('/app/editor/page/'.$table->id.'/'));
Expand All @@ -122,6 +124,7 @@ public function enabled(Template $table, TemplateItem $tableItem)
} catch (\Exception $e) {
$response = ['error' => $e];
}
$table->exportToFile();

return $response;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
*/
class Template extends AssetModel
{
use Exchangeable;
use HasFactory;
use SoftDeletes;
use Exchangeable;

protected $table = 'cms_template';

Expand Down
2 changes: 1 addition & 1 deletion src/Services/CmsExchange/AbstractExchangeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function import(bool $debug = false, bool $dryRun = false): void
$this->debug = $debug;
$this->dryRun = $dryRun;
$this->runImport();
}
}

protected function debug($text, $force = false)
{
Expand Down

0 comments on commit 55ddf61

Please sign in to comment.