Skip to content

Commit

Permalink
Fix #3720, model-from add isCreating isEditing methods
Browse files Browse the repository at this point in the history
  • Loading branch information
z-song committed Jul 29, 2019
1 parent 99861c5 commit c8a423c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Form.php
Expand Up @@ -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.
*
Expand Down

0 comments on commit c8a423c

Please sign in to comment.