Skip to content

Commit

Permalink
Check if model exist when creating a resource when it's impossible to…
Browse files Browse the repository at this point in the history
… satisfy dependencies
  • Loading branch information
wize-wiz committed Oct 11, 2019
1 parent d95cdef commit c69b2a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/HasDependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public function availableFields(NovaRequest $request)
if ($field instanceof NovaDependencyContainer) {
$availableFields[] = $field;
// @todo: this should only be checked on `$request->method() === 'PUT'`, e.g store/update.
if($field->areDependenciesSatisfied($request)) {
$model = $this->model();
if($field->areDependenciesSatisfied($request) || $model->id === null) {
// check if dependency is sta
if ($this->doesRouteRequireChildFields()) {
$this->extractChildFields($field->meta['fields']);
Expand Down

0 comments on commit c69b2a3

Please sign in to comment.