Skip to content

Commit

Permalink
Allows required traits inheritance (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbnhtl authored Apr 19, 2022
1 parent 1de49fc commit c453396
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Http/Controllers/PositionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ public function __invoke(NovaRequest $request)
$resourceId = $request->get('resourceId');
$model = $request->findModelOrFail($resourceId);

if (!in_array(Orderable::class, class_uses($model))) {
if (!in_array(Orderable::class, class_uses_recursive($model))) {
abort(500, trans('nova-order-nestedset-field::errors.model_should_use_trait', [
'class' => Orderable::class,
'model' => get_class($model),
]));
}

if (!in_array(NodeTrait::class, class_uses($model))) {
if (!in_array(NodeTrait::class, class_uses_recursive($model))) {
abort(500, trans('nova-order-nestedset-field::errors.model_should_use_trait', [
'class' => NodeTrait::class,
'model' => get_class($model),
Expand Down
4 changes: 2 additions & 2 deletions src/OrderNestedsetField.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ class OrderNestedsetField extends Field

protected function resolveAttribute($resource, $attribute)
{
if (!in_array(Orderable::class, class_uses($resource))) {
if (!in_array(Orderable::class, class_uses_recursive($resource))) {
abort(500, trans('nova-order-nestedset-field::errors.model_should_use_trait', [
'class' => Orderable::class,
'model' => get_class($resource),
]));
}

if (!in_array(NodeTrait::class, class_uses($resource))) {
if (!in_array(NodeTrait::class, class_uses_recursive($resource))) {
abort(500, trans('nova-order-nestedset-field::errors.model_should_use_trait', [
'class' => NodeTrait::class,
'model' => get_class($resource),
Expand Down

0 comments on commit c453396

Please sign in to comment.