| @@ -23,7 +23,7 @@ | ||
| 23 | 23 | public function boot() | 
| 24 | 24 |      { | 
| 25 | 25 | $this->publishes([ | 
| 26 | -            __DIR__ . '/../../config/sortable.php' => config_path('sortable.php'), | |
| 26 | +            __DIR__.'/../../config/sortable.php' => config_path('sortable.php'), | |
| 27 | 27 | ]); | 
| 28 | 28 | } | 
| 29 | 29 | |
| @@ -58,7 +58,7 @@ discard block | ||
| 58 | 58 | |
| 59 | 59 | $rules = [ | 
| 60 | 60 | 'type' => ['required', 'in:moveAfter,moveBefore'], | 
| 61 | -            'entityName' => ['required', 'in:' . implode(',', array_keys($sortableEntities))], | |
| 61 | +            'entityName' => ['required', 'in:'.implode(',', array_keys($sortableEntities))], | |
| 62 | 62 | 'id' => 'required', | 
| 63 | 63 | 'positionEntityId' => 'required', | 
| 64 | 64 | ]; | 
| @@ -76,20 +76,20 @@ discard block | ||
| 76 | 76 | $primaryKey = with(new $entityClass())->getKeyName(); | 
| 77 | 77 | |
| 78 | 78 |          if (!empty($connectionName)) { | 
| 79 | - $tableName = $connectionName . '.' . $tableName; | |
| 79 | + $tableName = $connectionName.'.'.$tableName; | |
| 80 | 80 | } | 
| 81 | 81 | |
| 82 | 82 |          if (!$relation) { | 
| 83 | - $rules['id'] .= '|exists:' . $tableName . ',' . $primaryKey; | |
| 84 | - $rules['positionEntityId'] .= '|exists:' . $tableName . ',' . $primaryKey; | |
| 83 | + $rules['id'] .= '|exists:'.$tableName.','.$primaryKey; | |
| 84 | + $rules['positionEntityId'] .= '|exists:'.$tableName.','.$primaryKey; | |
| 85 | 85 |          } else { | 
| 86 | 86 | /** @var BelongsToSortedMany $relationObject */ | 
| 87 | 87 | $relationObject = with(new $entityClass())->$relation(); | 
| 88 | 88 | $pivotTable = $relationObject->getTable(); | 
| 89 | 89 | |
| 90 | - $rules['parentId'] = 'required|exists:' . $tableName . ',' . $primaryKey; | |
| 91 | -            $rules['id'] .= '|exists:' . $pivotTable . ',' . $relationObject->getRelatedKey() . ',' . $relationObject->getForeignKey() . ',' . $request->input('parentId'); | |
| 92 | -            $rules['positionEntityId'] .= '|exists:' . $pivotTable . ',' . $relationObject->getRelatedKey() . ',' . $relationObject->getForeignKey() . ',' . $request->input('parentId'); | |
| 90 | + $rules['parentId'] = 'required|exists:'.$tableName.','.$primaryKey; | |
| 91 | +            $rules['id'] .= '|exists:'.$pivotTable.','.$relationObject->getRelatedKey().','.$relationObject->getForeignKey().','.$request->input('parentId'); | |
| 92 | +            $rules['positionEntityId'] .= '|exists:'.$pivotTable.','.$relationObject->getRelatedKey().','.$relationObject->getForeignKey().','.$request->input('parentId'); | |
| 93 | 93 | } | 
| 94 | 94 | |
| 95 | 95 | return $validator->make($request->all(), $rules); | 
| @@ -70,7 +70,7 @@ | ||
| 70 | 70 | * @return \Illuminate\Database\Eloquent\Relations\MorphToMany | 
| 71 | 71 | */ | 
| 72 | 72 | public function morphedBySortedMany($related, $name, $orderColumn = 'position', $table = null, $foreignPivotKey = null, | 
| 73 | - $relatedPivotKey = null, $parentKey = null, $relatedKey = null) | |
| 73 | + $relatedPivotKey = null, $parentKey = null, $relatedKey = null) | |
| 74 | 74 |      { | 
| 75 | 75 | $foreignPivotKey = $foreignPivotKey ?: $this->getForeignKey(); | 
| 76 | 76 | |
| @@ -41,7 +41,7 @@ discard block | ||
| 41 | 41 | // instances, as well as the relationship instances we need for these. | 
| 42 | 42 | $instance = $this->newRelatedInstance($related); | 
| 43 | 43 | |
| 44 | - $foreignPivotKey = $foreignPivotKey ?: $name . '_id'; | |
| 44 | + $foreignPivotKey = $foreignPivotKey ?: $name.'_id'; | |
| 45 | 45 | |
| 46 | 46 | $relatedPivotKey = $relatedPivotKey ?: $instance->getForeignKey(); | 
| 47 | 47 | |
| @@ -79,7 +79,7 @@ discard block | ||
| 79 | 79 | // For the inverse of the polymorphic many-to-many relations, we will change | 
| 80 | 80 | // the way we determine the foreign and other keys, as it is the opposite | 
| 81 | 81 | // of the morph-to-many method since we're figuring out these inverses. | 
| 82 | - $relatedPivotKey = $relatedPivotKey ?: $name . '_id'; | |
| 82 | + $relatedPivotKey = $relatedPivotKey ?: $name.'_id'; | |
| 83 | 83 | |
| 84 | 84 | return $this->morphToSortedMany( | 
| 85 | 85 | $related, $name, $orderColumn, $table, $foreignPivotKey, | 
| @@ -27,7 +27,7 @@ | ||
| 27 | 27 | * @return BelongsToSortedMany | 
| 28 | 28 | */ | 
| 29 | 29 | public function belongsToSortedMany($related, $orderColumn = 'position', $table = null, $foreignPivotKey = null, $relatedPivotKey = null, | 
| 30 | - $parentKey = null, $relatedKey = null, $relation = null) | |
| 30 | + $parentKey = null, $relatedKey = null, $relation = null) | |
| 31 | 31 |      { | 
| 32 | 32 | // If no relationship name was passed, we will pull backtraces to get the | 
| 33 | 33 | // name of the calling function. We will use that function name as the |