Refactor WarehouseProjectController methods to simplify parameters

This commit is contained in:
2025-12-02 15:57:49 +01:00
parent 697774a6b8
commit 14b7e69c42

View File

@@ -38,7 +38,7 @@ class WarehouseProjectController extends TTCrud {
private array $tempInternalTeam = []; private array $tempInternalTeam = [];
protected function beforeCreate($postData): bool { protected function beforeCreate(): bool {
$json = json_decode(file_get_contents('php://input'), true); $json = json_decode(file_get_contents('php://input'), true);
if ($json) { if ($json) {
$this->postData = array_merge($this->postData ?? [], $json); $this->postData = array_merge($this->postData ?? [], $json);
@@ -57,7 +57,7 @@ class WarehouseProjectController extends TTCrud {
return true; return true;
} }
protected function afterCreate($id, $postData): void protected function afterCreate($id): void
{ {
WarehouseProjectJournalModel::create([ WarehouseProjectJournalModel::create([
'projectId' => $id, 'projectId' => $id,
@@ -81,8 +81,9 @@ class WarehouseProjectController extends TTCrud {
} }
} }
protected function afterUpdate($id, $postData): void protected function afterUpdate($postData): void
{ {
$id = $postData['id'];
// Simple journaling of main record update // Simple journaling of main record update
WarehouseProjectJournalModel::create([ WarehouseProjectJournalModel::create([
'projectId' => $id, 'projectId' => $id,