@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | // First, we will need to determine the foreign key and "other key" for the |
| 36 | 36 | // relationship. Once we have determined the keys we will make the query |
| 37 | 37 | // instances, as well as the relationship instances we need for these. |
| 38 | - $foreignKey = $foreignKey ?: $name . '_id'; |
|
| 38 | + $foreignKey = $foreignKey ?: $name.'_id'; |
|
| 39 | 39 | |
| 40 | 40 | $instance = new $related(); |
| 41 | 41 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | // For the inverse of the polymorphic many-to-many relations, we will change |
| 69 | 69 | // the way we determine the foreign and other keys, as it is the opposite |
| 70 | 70 | // of the morph-to-many method since we're figuring out these inverses. |
| 71 | - $otherKey = $otherKey ?: $name . '_id'; |
|
| 71 | + $otherKey = $otherKey ?: $name.'_id'; |
|
| 72 | 72 | |
| 73 | 73 | return $this->morphToSortedMany($related, $name, $orderColumn, $table, $foreignKey, $otherKey, true); |
| 74 | 74 | } |
@@ -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 | ]; |
@@ -75,16 +75,16 @@ discard block |
||
| 75 | 75 | $primaryKey = with(new $entityClass())->getKeyName(); |
| 76 | 76 | |
| 77 | 77 | if (!$relation) { |
| 78 | - $rules['id'] .= '|exists:' . $tableName . ',' . $primaryKey; |
|
| 79 | - $rules['positionEntityId'] .= '|exists:' . $tableName . ',' . $primaryKey; |
|
| 78 | + $rules['id'] .= '|exists:'.$tableName.','.$primaryKey; |
|
| 79 | + $rules['positionEntityId'] .= '|exists:'.$tableName.','.$primaryKey; |
|
| 80 | 80 | } else { |
| 81 | 81 | /** @var BelongsToSortedMany $relationObject */ |
| 82 | 82 | $relationObject = with(new $entityClass())->$relation(); |
| 83 | 83 | $pivotTable = $relationObject->getTable(); |
| 84 | 84 | |
| 85 | - $rules['parentId'] = 'required|exists:' . $tableName . ',' . $primaryKey; |
|
| 86 | - $rules['id'] .= '|exists:' . $pivotTable . ',' . $relationObject->getRelatedKey() . ',' . $relationObject->getForeignKey() . ',' . $request->input('parentId'); |
|
| 87 | - $rules['positionEntityId'] .= '|exists:' . $pivotTable . ',' . $relationObject->getRelatedKey() . ',' . $relationObject->getForeignKey() . ',' . $request->input('parentId'); |
|
| 85 | + $rules['parentId'] = 'required|exists:'.$tableName.','.$primaryKey; |
|
| 86 | + $rules['id'] .= '|exists:'.$pivotTable.','.$relationObject->getRelatedKey().','.$relationObject->getForeignKey().','.$request->input('parentId'); |
|
| 87 | + $rules['positionEntityId'] .= '|exists:'.$pivotTable.','.$relationObject->getRelatedKey().','.$relationObject->getForeignKey().','.$request->input('parentId'); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | return $validator->make($request->all(), $rules); |