Skip to content

Commit

Permalink
Allows NULL on relationship with AJAX request (thedevdojo#4249)
Browse files Browse the repository at this point in the history
When jSelect ask for the possible relationships the response ignore the required option of the field.

This will ad dback the functionality, it also prevents the output of the 'NONE' option when using the search query
  • Loading branch information
hitech95 authored and emptynick committed Jul 18, 2019
1 parent 83b41a6 commit d763374
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Http/Controllers/VoyagerBaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,14 @@ public function relation(Request $request)
}

$results = [];

if (!$row->required && !$search) {
$results[] = [
'id' => '',
'text' => __('voyager::generic.none'),
];
}

foreach ($relationshipOptions as $relationshipOption) {
$results[] = [
'id' => $relationshipOption->{$options->key},
Expand Down

0 comments on commit d763374

Please sign in to comment.