diff --git a/src/Form.php b/src/Form.php index a0f462448d..de5e8d683a 100644 --- a/src/Form.php +++ b/src/Form.php @@ -1353,6 +1353,26 @@ public function header(Closure $callback = null) $callback->call($this, $this->builder->getTools()); } + /** + * Indicates if current form page is creating. + * + * @return bool + */ + public function isCreating() + { + return Str::endsWith(\request()->route()->getName(), '.create'); + } + + /** + * Indicates if current form page is editing. + * + * @return bool + */ + public function isEditing() + { + return Str::endsWith(\request()->route()->getName(), '.edit'); + } + /** * Disable form submit. *