Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
StyleCIBot committed Feb 17, 2022
1 parent 6795aca commit 55d403a
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 12 deletions.
22 changes: 17 additions & 5 deletions src/Model.php
Expand Up @@ -109,8 +109,15 @@ public function belongsTo($related, $foreignKey = null, $otherKey = null, $relat
* @param string $relation
* @return BelongsToMany
*/
public function belongsToMany($related, $table = null, $foreignPivotKey = null, $relatedPivotKey = null,
$parentKey = null, $relatedKey = null, $relation = null)
public function belongsToMany(
$related,
$table = null,
$foreignPivotKey = null,
$relatedPivotKey = null,
$parentKey = null,
$relatedKey = null,
$relation = null
)
{
if (is_null($relation)) {
$relation = $this->guessBelongsToManyRelation();
Expand All @@ -129,9 +136,14 @@ public function belongsToMany($related, $table = null, $foreignPivotKey = null,
}

return new BelongsToMany(
$instance->newQuery(), $this, $table, $foreignPivotKey,
$relatedPivotKey, $parentKey ?: $this->getKeyName(),
$relatedKey ?: $instance->getKeyName(), $relation
$instance->newQuery(),
$this,
$table,
$foreignPivotKey,
$relatedPivotKey,
$parentKey ?: $this->getKeyName(),
$relatedKey ?: $instance->getKeyName(),
$relation
);
}

Expand Down
5 changes: 4 additions & 1 deletion src/Model/Menu.php
Expand Up @@ -27,7 +27,10 @@ class Menu extends Taxonomy
public function items()
{
return $this->belongsToMany(
MenuItem::class, 'term_relationships', 'term_taxonomy_id', 'object_id'
MenuItem::class,
'term_relationships',
'term_taxonomy_id',
'object_id'
)->orderBy('menu_order');
}
}
3 changes: 2 additions & 1 deletion src/Model/MenuItem.php
Expand Up @@ -59,7 +59,8 @@ public function instance()
protected function getClassName()
{
return Arr::get(
$this->instanceRelations, $this->meta->_menu_item_object
$this->instanceRelations,
$this->meta->_menu_item_object
);
}
}
9 changes: 7 additions & 2 deletions src/Model/Post.php
Expand Up @@ -188,7 +188,10 @@ public function thumbnail()
public function taxonomies()
{
return $this->belongsToMany(
Taxonomy::class, 'term_relationships', 'object_id', 'term_taxonomy_id'
Taxonomy::class,
'term_relationships',
'object_id',
'term_taxonomy_id'
);
}

Expand Down Expand Up @@ -382,7 +385,9 @@ public function getFormat()

if ($taxonomy && $taxonomy->term) {
return str_replace(
'post-format-', '', $taxonomy->term->slug
'post-format-',
'',
$taxonomy->term->slug
);
}

Expand Down
5 changes: 4 additions & 1 deletion src/Model/Taxonomy.php
Expand Up @@ -64,7 +64,10 @@ public function parent()
public function posts()
{
return $this->belongsToMany(
Post::class, 'term_relationships', 'term_taxonomy_id', 'object_id'
Post::class,
'term_relationships',
'term_taxonomy_id',
'object_id'
);
}

Expand Down
6 changes: 4 additions & 2 deletions tests/Unit/Model/PostTest.php
Expand Up @@ -555,7 +555,8 @@ private function createPostWithTaxonomiesAndTerms(): Post
$post->taxonomies()->attach(
factory(Taxonomy::class)->create([
'taxonomy' => 'foo',
])->term_taxonomy_id, [
])->term_taxonomy_id,
[
'term_order' => 0,
]
);
Expand Down Expand Up @@ -599,7 +600,8 @@ private function createPostWithPostFormatTaxonomy(): Post
'slug' => $name,
])->term_id;
},
])->term_taxonomy_id, [
])->term_taxonomy_id,
[
'term_order' => 0,
]
);
Expand Down

0 comments on commit 55d403a

Please sign in to comment.