Skip to content

Commit

Permalink
Merge pull request #36 from anavel/analysis-8ma6KV
Browse files Browse the repository at this point in the history
Applied fixes from StyleCI
  • Loading branch information
ablunier committed Jun 17, 2016
2 parents 3f296a8 + 6afe248 commit 337f797
Show file tree
Hide file tree
Showing 19 changed files with 19 additions and 35 deletions.
1 change: 0 additions & 1 deletion src/Abstractor/Eloquent/Model.php
Expand Up @@ -224,7 +224,6 @@ public function getRelations()
} else {
$relations->put($relationName, $relation);
}

}
}

Expand Down
1 change: 0 additions & 1 deletion src/Abstractor/Eloquent/ModelFactory.php
Expand Up @@ -89,7 +89,6 @@ public function getByName($name, $id = null)

public function getByClassName($classname, array $config, $id = null)
{

$model = new Model(array_merge(['model' => $classname], $config), $this->modelManager->getAbstractionLayer($classname), $this->relationFactory, $this->fieldFactory, $this->generator);
$model->setSlug($this->slugger->slugify((new ReflectionClass($classname))->getShortName()));

Expand Down
1 change: 0 additions & 1 deletion src/Abstractor/Eloquent/Relation/MiniCrud.php
Expand Up @@ -326,4 +326,3 @@ public function addSecondaryRelationFields(array $fields)
return $fields;
}
}

1 change: 0 additions & 1 deletion src/Abstractor/Eloquent/Relation/MiniCrudPolymorphic.php
Expand Up @@ -40,4 +40,3 @@ public function getDisplayType()
return self::DISPLAY_TYPE_TAB;
}
}

3 changes: 1 addition & 2 deletions src/Abstractor/Eloquent/Relation/MiniCrudSingle.php
Expand Up @@ -26,7 +26,7 @@ public function setup()
*/
public function getEditFields($arrayKey = null)
{
if(empty($arrayKey)) {
if (empty($arrayKey)) {
$arrayKey = $this->name;
}

Expand Down Expand Up @@ -154,4 +154,3 @@ public function getDisplayType()
return self::DISPLAY_TYPE_TAB;
}
}

Expand Up @@ -45,5 +45,4 @@ protected function getColumn($dbal)
{
return $dbal->getTableColumn($this->eloquentRelation->getRelated()->getKeyName());
}

}
@@ -1,7 +1,6 @@
<?php
namespace Anavel\Crud\Abstractor\Eloquent\Relation\Traits;


use Anavel\Crud\Abstractor\Exceptions\RelationException;

trait CheckRelationCompatibility
Expand All @@ -12,4 +11,4 @@ public function checkRelationCompatibility()
throw new RelationException(get_class($this->eloquentRelation)." eloquent relation is not compatible with ".$this->getType()." type");
}
}
}
}
@@ -1,7 +1,6 @@
<?php
namespace Anavel\Crud\Abstractor\Eloquent\Relation\Traits;


use Anavel\Crud\Abstractor\Exceptions\RelationException;

trait CheckRelationConfig
Expand All @@ -19,4 +18,4 @@ public function checkNameConfig($config)
throw new RelationException('Relation name should be set');
}
}
}
}
2 changes: 1 addition & 1 deletion src/Abstractor/Eloquent/Traits/HandleFiles.php
Expand Up @@ -63,4 +63,4 @@ protected function handleField(Request $request, $item, array $fields, $groupNam
'skip' => $skip
];
}
}
}
3 changes: 1 addition & 2 deletions src/Abstractor/Eloquent/Traits/ModelFields.php
Expand Up @@ -3,7 +3,6 @@

namespace Anavel\Crud\Abstractor\Eloquent\Traits;


use Anavel\Crud\Contracts\Abstractor\Field;

trait ModelFields
Expand Down Expand Up @@ -51,4 +50,4 @@ public function setConfig(array $config, $columnName)

return $config;
}
}
}
1 change: 0 additions & 1 deletion src/Abstractor/Exceptions/AbstractorException.php
Expand Up @@ -3,5 +3,4 @@

class AbstractorException extends \Exception
{

}
1 change: 0 additions & 1 deletion src/Abstractor/Exceptions/FactoryException.php
Expand Up @@ -3,5 +3,4 @@

class FactoryException extends \Exception
{

}
1 change: 0 additions & 1 deletion src/Abstractor/Exceptions/RelationException.php
Expand Up @@ -3,5 +3,4 @@

class RelationException extends \Exception
{

}
2 changes: 1 addition & 1 deletion src/Contracts/Controllers/CustomController.php
Expand Up @@ -23,4 +23,4 @@ public function edit($model, $id);
public function update(Request $request, $model, $id);

public function destroy(Request $request, $model, $id);
}
}
5 changes: 2 additions & 3 deletions src/Http/Controllers/HomeController.php
Expand Up @@ -23,12 +23,11 @@ public function index(ModelAbstractorFactory $modelFactory)
$modelAbstractor = $modelFactory->getByName($modelSlug);
$config = $modelAbstractor->getConfig();

if (! array_key_exists('authorize', $config) || ( $config['authorize'] === true && Gate::allows('adminIndex', $modelAbstractor->getInstance()) || $config['authorize'] === false )) {
if (! array_key_exists('authorize', $config) || ($config['authorize'] === true && Gate::allows('adminIndex', $modelAbstractor->getInstance()) || $config['authorize'] === false)) {
return new RedirectResponse(route('anavel-crud.model.index', $modelSlug));
}

}

abort(403);
}
}
}
16 changes: 8 additions & 8 deletions src/Http/Form/Generator.php
Expand Up @@ -133,14 +133,14 @@ protected function addFormFields(array $fields, $key)
$formFields = array();
$tempFields = array();

foreach ($fields as $fieldKey => $field) {
if (is_array($field)) {
$group = $this->addFormFields($field, $fieldKey);
$tempFields[key($group)] = $this->factory->get('group', [$group[key($group)]]);
} else {
$tempFields[$field->getName()] = $field->getFormField();
}
foreach ($fields as $fieldKey => $field) {
if (is_array($field)) {
$group = $this->addFormFields($field, $fieldKey);
$tempFields[key($group)] = $this->factory->get('group', [$group[key($group)]]);
} else {
$tempFields[$field->getName()] = $field->getFormField();
}
}
$formFields[$key] = $tempFields;
return $formFields;
}
Expand All @@ -160,4 +160,4 @@ protected function addValidationRules(array $fields, $key)
$rules[$key] = $tempFields;
return $rules;
}
}
}
1 change: 0 additions & 1 deletion src/Providers/ViewComposersServiceProvider.php
Expand Up @@ -12,7 +12,6 @@ class ViewComposersServiceProvider extends ServiceProvider
*/
public function boot()
{

}

/**
Expand Down
6 changes: 2 additions & 4 deletions src/View/Composers/SidebarComposer.php
Expand Up @@ -28,7 +28,6 @@ public function compose($view)
*/
private function getSidebarItems()
{

$modelsGroups = config('anavel-crud.modelsGroups');
$models = config('anavel-crud.models');
$menuItems = [];
Expand Down Expand Up @@ -67,9 +66,8 @@ private function getSidebarItems()
}

//Sort alphabetically de menu items
usort($menuItems, function($itemA, $itemB)
{
return strcmp($itemA['name'],$itemB['name']);
usort($menuItems, function ($itemA, $itemB) {
return strcmp($itemA['name'], $itemB['name']);
});
return $menuItems;
}
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.php
Expand Up @@ -41,4 +41,4 @@ function transcrud($text)

return str_replace('anavel-crud::models.', '', $translation);
}
}
}

0 comments on commit 337f797

Please sign in to comment.