Skip to content

Commit

Permalink
Update CustomRelationshipFieldTrait.php (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
littlemiaor authored Feb 7, 2020
1 parent 5db90cb commit 1d766f4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/CustomRelationshipFieldTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,31 @@ public function resolveActions(NovaRequest $request)

}

/**
* Get the cards for the given request.
*
* @param NovaRequest $request
*
* @return Collection
*/
public function resolveCards(NovaRequest $request)
{

if ($method = $request->input('customRelationshipFieldAttribute')) {

$method = "{$method}Cards";

if (method_exists($this, $method)) {

return collect(array_values($this->filter($this->$method($request))));

}

}

return parent::resolveCards($request);
}

/**
* Get the filters for the given request.
*
Expand Down

0 comments on commit 1d766f4

Please sign in to comment.