mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
fix(graphql): fixed eager load nodes children (#949)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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<string>
|
||||
*/
|
||||
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<string>
|
||||
* @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<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
Imageable::ATTRIBUTE_DEPTH => 'int',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the image that owns the imageable.
|
||||
|
||||
@@ -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<string>
|
||||
*/
|
||||
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<string>
|
||||
* @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.
|
||||
|
||||
Reference in New Issue
Block a user