@@ -3,10 +3,8 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Anavel\Crud\Abstractor\Eloquent\Relation\Traits\CheckRelationCompatibility; |
| 5 | 5 | use Anavel\Crud\Contracts\Abstractor\Field; |
| 6 | -use App; |
|
| 7 | 6 | use Illuminate\Database\Eloquent\Model; |
| 8 | 7 | use Illuminate\Http\Request; |
| 9 | -use Illuminate\Support\Collection; |
|
| 10 | 8 | |
| 11 | 9 | class MiniCrudSingle extends Relation |
| 12 | 10 | { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $this->readConfig('edit'); |
| 50 | 50 | |
| 51 | - if (! empty($columns)) { |
|
| 51 | + if (!empty($columns)) { |
|
| 52 | 52 | //Add field for model deletion |
| 53 | 53 | $config = [ |
| 54 | 54 | 'name' => '__delete', |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $config = [ |
| 76 | 76 | 'name' => $columnName, |
| 77 | - 'presentation' => $this->name . ' ' . ucfirst(transcrud($columnName)), |
|
| 77 | + 'presentation' => $this->name.' '.ucfirst(transcrud($columnName)), |
|
| 78 | 78 | 'form_type' => $formType, |
| 79 | 79 | 'no_validate' => true, |
| 80 | 80 | 'validation' => null, |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | ->setConfig($config) |
| 90 | 90 | ->get(); |
| 91 | 91 | |
| 92 | - if (! empty($result->id)) { |
|
| 92 | + if (!empty($result->id)) { |
|
| 93 | 93 | $field->setValue($result->getAttribute($columnName)); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -109,9 +109,9 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function persist(array $relationArray = null, Request $request) |
| 111 | 111 | { |
| 112 | - if (! empty($relationArray)) { |
|
| 112 | + if (!empty($relationArray)) { |
|
| 113 | 113 | $currentRelation = $this->eloquentRelation->getResults(); |
| 114 | - if (! empty($currentRelation)) { |
|
| 114 | + if (!empty($currentRelation)) { |
|
| 115 | 115 | $relationModel = $currentRelation; |
| 116 | 116 | } else { |
| 117 | 117 | $relationModel = $this->eloquentRelation->getRelated()->newInstance(); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $relationModel->setAttribute($fieldKey, $fieldValue); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - if (! $shouldBeSkipped) { |
|
| 136 | + if (!$shouldBeSkipped) { |
|
| 137 | 137 | $relationModel->save(); |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -2,9 +2,7 @@ |
||
| 2 | 2 | namespace Anavel\Crud\Abstractor\Eloquent\Relation; |
| 3 | 3 | |
| 4 | 4 | use Anavel\Crud\Abstractor\Eloquent\Relation\Traits\CheckRelationCompatibility; |
| 5 | -use Anavel\Crud\Abstractor\Eloquent\Relation\Traits\CheckRelationConfig; |
|
| 6 | 5 | use Anavel\Crud\Repository\Criteria\InArrayCriteria; |
| 7 | -use App; |
|
| 8 | 6 | use Doctrine\DBAL\Schema\Column; |
| 9 | 7 | use Illuminate\Http\Request; |
| 10 | 8 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function persist(array $relationArray = null) |
| 30 | 30 | { |
| 31 | - if (! empty($relationArray)) { |
|
| 31 | + if (!empty($relationArray)) { |
|
| 32 | 32 | /** @var \ANavallaSuiza\Laravel\Database\Contracts\Repository\Repository $repo */ |
| 33 | 33 | $repo = $this->modelManager->getRepository(get_class($this->eloquentRelation->getRelated())); |
| 34 | 34 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $alreadyAssociated = $this->relatedModel->$relationName; |
| 38 | 38 | |
| 39 | 39 | $search = []; |
| 40 | - if (! empty($relationArray[$relatedKeyName])) { |
|
| 40 | + if (!empty($relationArray[$relatedKeyName])) { |
|
| 41 | 41 | $search = $relationArray[$relatedKeyName]; |
| 42 | 42 | } |
| 43 | 43 | $results = $repo->pushCriteria( |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $result->save(); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if (! $missing->isEmpty()) { |
|
| 56 | + if (!$missing->isEmpty()) { |
|
| 57 | 57 | foreach ($missing as $result) { |
| 58 | 58 | $result->$keyName = null; |
| 59 | 59 | $result->save(); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | { |
| 99 | 99 | $results = $this->eloquentRelation->getResults(); |
| 100 | 100 | |
| 101 | - if (! $results->isEmpty()) { |
|
| 101 | + if (!$results->isEmpty()) { |
|
| 102 | 102 | $values = []; |
| 103 | 103 | |
| 104 | 104 | foreach ($results as $result) { |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | |
| 4 | 4 | use Anavel\Crud\Abstractor\Eloquent\Relation\Traits\CheckRelationCompatibility; |
| 5 | 5 | use Anavel\Crud\Contracts\Abstractor\Field; |
| 6 | -use App; |
|
| 7 | 6 | use Illuminate\Http\Request; |
| 8 | 7 | |
| 9 | 8 | class Translation extends Relation |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | $translationFields = []; |
| 49 | - if (! empty($columns)) { |
|
| 49 | + if (!empty($columns)) { |
|
| 50 | 50 | foreach ($this->langs as $key => $lang) { |
| 51 | 51 | $tempFields = []; |
| 52 | 52 | foreach ($columns as $columnName => $column) { |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | $config = [ |
| 68 | 68 | 'name' => $columnName, |
| 69 | - 'presentation' => ucfirst(transcrud($columnName)) . ' [' . $lang . ']', |
|
| 69 | + 'presentation' => ucfirst(transcrud($columnName)).' ['.$lang.']', |
|
| 70 | 70 | 'form_type' => $formType, |
| 71 | 71 | 'no_validate' => true, |
| 72 | 72 | 'validation' => null, |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function persist(array $relationArray = null, Request $request) |
| 108 | 108 | { |
| 109 | - if (! empty($relationArray)) { |
|
| 109 | + if (!empty($relationArray)) { |
|
| 110 | 110 | $currentTranslations = $this->eloquentRelation->getResults(); |
| 111 | 111 | $currentTranslations = $currentTranslations->keyBy('locale'); |
| 112 | 112 | |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | { |
| 6 | 6 | public function getConfigValue() |
| 7 | 7 | { |
| 8 | - if (! property_exists($this, 'config') || ! is_array($this->config) || empty($this->config)) { |
|
| 8 | + if (!property_exists($this, 'config') || !is_array($this->config) || empty($this->config)) { |
|
| 9 | 9 | return null; |
| 10 | 10 | } |
| 11 | 11 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | if (is_array($params) && count($params) > 0) { |
| 19 | 19 | foreach ($params as $configKey) { |
| 20 | - if (! array_key_exists($configKey, $nestedConfig)) { |
|
| 20 | + if (!array_key_exists($configKey, $nestedConfig)) { |
|
| 21 | 21 | $nestedConfig = array(); |
| 22 | 22 | return null; |
| 23 | 23 | } |
@@ -103,7 +103,7 @@ |
||
| 103 | 103 | { |
| 104 | 104 | $results = $this->eloquentRelation->getResults(); |
| 105 | 105 | |
| 106 | - if (! empty($results)) { |
|
| 106 | + if (!empty($results)) { |
|
| 107 | 107 | $field->setValue($results->getKey()); |
| 108 | 108 | } |
| 109 | 109 | return $field; |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public function checkRelationCompatibility() |
| 10 | 10 | { |
| 11 | - if (! in_array(get_class($this->eloquentRelation), $this->compatibleEloquentRelations)) { |
|
| 11 | + if (!in_array(get_class($this->eloquentRelation), $this->compatibleEloquentRelations)) { |
|
| 12 | 12 | throw new RelationException(get_class($this->eloquentRelation)." eloquent relation is not compatible with ".$this->getType()." type"); |
| 13 | 13 | } |
| 14 | 14 | } |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | public function get($name) |
| 74 | 74 | { |
| 75 | - if (! empty($this->config) && ! empty($this->config['name'])) { |
|
| 75 | + if (!empty($this->config) && !empty($this->config['name'])) { |
|
| 76 | 76 | $name = $this->config['name']; |
| 77 | 77 | } |
| 78 | - if (! method_exists($this->model, $name)) { |
|
| 79 | - throw new FactoryException("Relation " . $name . " does not exist on " . get_class($this->model)); |
|
| 78 | + if (!method_exists($this->model, $name)) { |
|
| 79 | + throw new FactoryException("Relation ".$name." does not exist on ".get_class($this->model)); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $relationInstance = $this->model->$name(); |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | if (empty($this->config['type'])) { |
| 87 | - if (! array_key_exists($relationEloquentType, $this->eloquentTypeToRelationType)) { |
|
| 88 | - throw new FactoryException($relationEloquentType . " relation not supported"); |
|
| 87 | + if (!array_key_exists($relationEloquentType, $this->eloquentTypeToRelationType)) { |
|
| 88 | + throw new FactoryException($relationEloquentType." relation not supported"); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $type = $this->eloquentTypeToRelationType[$relationEloquentType]; |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | $type = $this->config['type']; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if (! array_key_exists($type, $this->typesMap)) { |
|
| 97 | - throw new FactoryException("Unexpected relation type: " . $type); |
|
| 96 | + if (!array_key_exists($type, $this->typesMap)) { |
|
| 97 | + throw new FactoryException("Unexpected relation type: ".$type); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $this->config['name'] = $name; |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $this->app->bind( |
| 49 | 49 | 'Anavel\Crud\Contracts\Abstractor\FieldFactory', |
| 50 | - function () { |
|
| 50 | + function() { |
|
| 51 | 51 | return new FieldAbstractorFactory(new FormFactory); |
| 52 | 52 | } |
| 53 | 53 | ); |
| 54 | 54 | |
| 55 | 55 | $this->app->bind( |
| 56 | 56 | 'Anavel\Crud\Contracts\Abstractor\RelationFactory', |
| 57 | - function () { |
|
| 57 | + function() { |
|
| 58 | 58 | return new RelationAbstractorFactory( |
| 59 | 59 | $this->app['ANavallaSuiza\Laravel\Database\Contracts\Manager\ModelManager'], |
| 60 | 60 | $this->app['Anavel\Crud\Contracts\Abstractor\FieldFactory'] |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | $this->app->bind( |
| 66 | 66 | 'Anavel\Crud\Contracts\Abstractor\ModelFactory', |
| 67 | - function () { |
|
| 67 | + function() { |
|
| 68 | 68 | return new ModelAbstractorFactory( |
| 69 | 69 | config('anavel-crud.models'), |
| 70 | 70 | $this->app['ANavallaSuiza\Laravel\Database\Contracts\Manager\ModelManager'], |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | $this->app->bind( |
| 79 | 79 | 'Anavel\Crud\Contracts\Form\Generator', |
| 80 | - function () { |
|
| 80 | + function() { |
|
| 81 | 81 | return new FormGenerator(new FormFactory); |
| 82 | 82 | } |
| 83 | 83 | ); |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | 'prefix' => 'crud', |
| 6 | 6 | 'namespace' => 'Anavel\Crud\Http\Controllers' |
| 7 | 7 | ], |
| 8 | - function () { |
|
| 8 | + function() { |
|
| 9 | 9 | Route::get('/', [ |
| 10 | 10 | 'as' => 'anavel-crud.home', |
| 11 | 11 | 'uses' => 'HomeController@index' |