Open
Description
Description
I often end up in 90% of the cases to adjust the default redirect from index to the view.
As after creating the record, you usually want to interact with it right away, or see the details on it with links to follow up on.
Index: templates/bake/element/Controller/add.twig
<+>UTF-8
===================================================================
diff --git a/templates/bake/element/Controller/add.twig b/templates/bake/element/Controller/add.twig
@@ -30,7 +30,7 @@
if ($this->{{ currentModelName }}->save(${{ singularName }})) {
$this->Flash->success(__('The {{ singularHumanName|lower }} has been saved.'));
- return $this->redirect(['action' => 'index']);
+ return $this->redirect(['action' => 'view', ${{ singularName }}->id]);
}
$this->Flash->error(__('The {{ singularHumanName|lower }} could not be saved. Please, try again.'));
}
Would it make sense to adjust the bake templates here?
What do others think?