diff --git a/app/Concerns/Actions/GraphQL/ConstrainsEagerLoads.php b/app/Concerns/Actions/GraphQL/ConstrainsEagerLoads.php index fc8b474d7..aef079207 100644 --- a/app/Concerns/Actions/GraphQL/ConstrainsEagerLoads.php +++ b/app/Concerns/Actions/GraphQL/ConstrainsEagerLoads.php @@ -122,6 +122,7 @@ trait ConstrainsEagerLoads $this->sort($query, $args, $type); $child = Arr::get($selection, 'selectionSet.data.data.selectionSet') + ?? Arr::get($selection, 'selectionSet.nodes.nodes.selectionSet') ?? Arr::get($selection, 'selectionSet', []); $this->processEagerLoadForType($query, $child, $type); diff --git a/app/Pivots/Morph/Imageable.php b/app/Pivots/Morph/Imageable.php index 2bded1d8a..a50b704bd 100644 --- a/app/Pivots/Morph/Imageable.php +++ b/app/Pivots/Morph/Imageable.php @@ -62,18 +62,16 @@ class Imageable extends BaseMorphPivot protected $table = Imageable::TABLE; /** - * Get the composite primary key for the pivot. + * The attributes that are mass assignable. * - * @return string[] + * @var list */ - protected function getPrimaryKeys(): array - { - return [ - Imageable::ATTRIBUTE_IMAGE, - Imageable::ATTRIBUTE_IMAGEABLE_TYPE, - Imageable::ATTRIBUTE_IMAGEABLE_ID, - ]; - } + protected $fillable = [ + Imageable::ATTRIBUTE_DEPTH, + Imageable::ATTRIBUTE_IMAGE, + Imageable::ATTRIBUTE_IMAGEABLE_TYPE, + Imageable::ATTRIBUTE_IMAGEABLE_ID, + ]; /** * The event map for the model. @@ -89,16 +87,30 @@ class Imageable extends BaseMorphPivot ]; /** - * The attributes that are mass assignable. + * Get the composite primary key for the pivot. * - * @var list + * @return string[] */ - protected $fillable = [ - Imageable::ATTRIBUTE_DEPTH, - Imageable::ATTRIBUTE_IMAGE, - Imageable::ATTRIBUTE_IMAGEABLE_TYPE, - Imageable::ATTRIBUTE_IMAGEABLE_ID, - ]; + protected function getPrimaryKeys(): array + { + return [ + Imageable::ATTRIBUTE_IMAGE, + Imageable::ATTRIBUTE_IMAGEABLE_TYPE, + Imageable::ATTRIBUTE_IMAGEABLE_ID, + ]; + } + + /** + * Get the attributes that should be cast. + * + * @return array + */ + protected function casts(): array + { + return [ + Imageable::ATTRIBUTE_DEPTH => 'int', + ]; + } /** * Gets the image that owns the imageable. diff --git a/app/Pivots/Morph/Resourceable.php b/app/Pivots/Morph/Resourceable.php index 3aafdfbb4..7865c3f66 100644 --- a/app/Pivots/Morph/Resourceable.php +++ b/app/Pivots/Morph/Resourceable.php @@ -64,18 +64,16 @@ class Resourceable extends BaseMorphPivot protected $table = Resourceable::TABLE; /** - * Get the composite primary key for the pivot. + * The attributes that are mass assignable. * - * @return string[] + * @var list */ - protected function getPrimaryKeys(): array - { - return [ - Resourceable::ATTRIBUTE_RESOURCE, - Resourceable::ATTRIBUTE_RESOURCEABLE_TYPE, - Resourceable::ATTRIBUTE_RESOURCEABLE_ID, - ]; - } + protected $fillable = [ + Resourceable::ATTRIBUTE_AS, + Resourceable::ATTRIBUTE_RESOURCE, + Resourceable::ATTRIBUTE_RESOURCEABLE_TYPE, + Resourceable::ATTRIBUTE_RESOURCEABLE_ID, + ]; /** * The event map for the model. @@ -91,16 +89,18 @@ class Resourceable extends BaseMorphPivot ]; /** - * The attributes that are mass assignable. + * Get the composite primary key for the pivot. * - * @var list + * @return string[] */ - protected $fillable = [ - Resourceable::ATTRIBUTE_AS, - Resourceable::ATTRIBUTE_RESOURCE, - Resourceable::ATTRIBUTE_RESOURCEABLE_TYPE, - Resourceable::ATTRIBUTE_RESOURCEABLE_ID, - ]; + protected function getPrimaryKeys(): array + { + return [ + Resourceable::ATTRIBUTE_RESOURCE, + Resourceable::ATTRIBUTE_RESOURCEABLE_TYPE, + Resourceable::ATTRIBUTE_RESOURCEABLE_ID, + ]; + } /** * Gets the resource that owns the resourceable.