update
This commit is contained in:
@@ -40,11 +40,16 @@ class DatastoreRepository extends BaseRepository implements DatastoreRepositoryI
|
||||
{
|
||||
$model = $this->model;
|
||||
if (count($relationships) > 0) {
|
||||
$validRelationships = [];
|
||||
foreach ($relationships as $relationship) {
|
||||
if (method_exists($model, $relationship)) {
|
||||
$model = $model->with($relationship);
|
||||
$firstRelation = explode('.', $relationship)[0];
|
||||
if (method_exists($model, $firstRelation)) {
|
||||
$validRelationships[] = $relationship;
|
||||
}
|
||||
}
|
||||
if (count($validRelationships) > 0) {
|
||||
$model = $model->with($validRelationships);
|
||||
}
|
||||
}
|
||||
|
||||
// Xử lý withCount
|
||||
|
||||
Reference in New Issue
Block a user