@@ -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 | |
@@ -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 |