Skip to content

Commit

Permalink
Style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
boxfrommars committed Aug 31, 2017
1 parent 146fa80 commit 6f5c58a
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 22 deletions.
18 changes: 9 additions & 9 deletions src/Rutorika/Sortable/BelongsToSortedMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class BelongsToSortedMany extends BelongsToMany
* Create a new belongs to many relationship instance.
* Sets default ordering by $orderColumn column.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param \Illuminate\Database\Eloquent\Model $parent
* @param string $table
* @param string $foreignPivotKey
* @param string $relatedPivotKey
* @param string $parentKey
* @param string $relatedKey
* @param string $relationName
* @param string $orderColumn position column name
* @param Builder $query
* @param Model $parent
* @param string $table
* @param string $foreignPivotKey
* @param string $relatedPivotKey
* @param string $parentKey
* @param string $relatedKey
* @param string $relationName
* @param string $orderColumn position column name
*/
public function __construct(Builder $query, Model $parent, $table, $foreignPivotKey,
$relatedPivotKey, $parentKey, $relatedKey, $relationName = null, $orderColumn = null)
Expand Down
22 changes: 22 additions & 0 deletions src/Rutorika/Sortable/BelongsToSortedManyTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,26 @@ abstract public function getForeignKey();
* @return string
*/
abstract protected function getRelations();

/**
* Get the relationship name of the belongs to many.
*
* @return string
*/
abstract protected function guessBelongsToManyRelation();

/**
* Create a new model instance for a related model.
*
* @param string $class
* @return mixed
*/
abstract protected function newRelatedInstance($class);

/**
* Get the primary key for the model.
*
* @return string
*/
abstract public function getKeyName();
}
24 changes: 12 additions & 12 deletions src/Rutorika/Sortable/MorphToSortedMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ class MorphToSortedMany extends MorphToMany
/**
* Create a new morph to many relationship instance.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @param \Illuminate\Database\Eloquent\Model $parent
* @param string $name
* @param string $table
* @param string $foreignPivotKey
* @param string $relatedPivotKey
* @param string $parentKey
* @param string $relatedKey
* @param string $orderColumn
* @param string $relationName
* @param bool $inverse
* @param Builder $query
* @param Model $parent
* @param string $name
* @param string $table
* @param string $foreignPivotKey
* @param string $relatedPivotKey
* @param string $parentKey
* @param string $relatedKey
* @param string $orderColumn
* @param string $relationName
* @param bool $inverse
*/
public function __construct(Builder $query, Model $parent, $name, $table, $foreignPivotKey,
$relatedPivotKey, $parentKey, $relatedKey, $orderColumn, $relationName = null, $inverse = false)
{
parent::__construct($query, $parent, $name, $table, $foreignPivotKey,
$relatedPivotKey, $parentKey, $relatedKey, $relationName = null, $inverse = false);
$relatedPivotKey, $parentKey, $relatedKey, $relationName = null, $inverse = false);
$this->setOrderColumn($orderColumn);
}
}
22 changes: 22 additions & 0 deletions src/Rutorika/Sortable/MorphToSortedManyTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,26 @@ abstract public function getForeignKey();
* @return string
*/
abstract protected function getRelations();

/**
* Get the relationship name of the belongs to many.
*
* @return string
*/
abstract protected function guessBelongsToManyRelation();

/**
* Create a new model instance for a related model.
*
* @param string $class
* @return mixed
*/
abstract protected function newRelatedInstance($class);

/**
* Get the primary key for the model.
*
* @return string
*/
abstract public function getKeyName();
}
2 changes: 1 addition & 1 deletion src/config/sortable.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
return [
'entities' => [
// 'articles' => '\Article' for simple sorting (entityName => entityModel) or
// 'articles' => ['entity' => '\Article', 'relation' => 'tags'] for many to many or many to many polymorphic relation sorting
// 'posts' => ['entity' => '\Post', 'relation' => 'tags'] for many to many or many to many polymorphic relation sorting
],
];

0 comments on commit 6f5c58a

Please sign in to comment.