Skip to content

Commit

Permalink
Apply fixes from StyleCI (#75)
Browse files Browse the repository at this point in the history
[ci skip] [skip ci]

Co-authored-by: StyleCI Bot <[email protected]>
  • Loading branch information
sampoyigi and StyleCIBot authored May 4, 2022
1 parent cdf1848 commit 6c29d13
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,11 @@ protected function sanctumConfigureMiddleware()
protected function sanctumConfigureAuthModels()
{
Users_model::extend(function (Model $model) {
$model->relation['morphMany']['tokens'] = [Sanctum::$personalAccessTokenModel, 'name' => 'tokenable', 'delete' => TRUE];
$model->relation['morphMany']['tokens'] = [Sanctum::$personalAccessTokenModel, 'name' => 'tokenable', 'delete' => true];
});

Customers_model::extend(function (Model $model) {
$model->relation['morphMany']['tokens'] = [Sanctum::$personalAccessTokenModel, 'name' => 'tokenable', 'delete' => TRUE];
$model->relation['morphMany']['tokens'] = [Sanctum::$personalAccessTokenModel, 'name' => 'tokenable', 'delete' => true];
});
}

Expand Down
14 changes: 7 additions & 7 deletions auth/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,20 @@ public function checkGroup(string $group, $token)
{
if (!is_null($token)) {
if ($group == 'guest')
return FALSE;
return false;

if ($group == 'admin' && !$token->isForAdmin())
return FALSE;
return false;

if ($group == 'customer' && $token->isForAdmin())
return FALSE;
return false;
}
else {
if (in_array($group, ['admin', 'customer', 'users']))
return FALSE;
return false;
}

return TRUE;
return true;
}

/**
Expand Down Expand Up @@ -147,10 +147,10 @@ public function findToken($token)
protected function supportsTokens($tokenable = null)
{
if (is_null($tokenable))
return FALSE;
return false;

if (in_array(HasApiTokens::class, class_uses_recursive(get_class($tokenable))))
return TRUE;
return true;

return $tokenable instanceof \Igniter\Flame\Auth\Models\User && $tokenable->hasRelation('tokens');
}
Expand Down
4 changes: 2 additions & 2 deletions classes/AbstractRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function create(Model $model, array $attributes)
}
});

$this->fireSystemEvent('api.repository.afterCreate', [$model, TRUE]);
$this->fireSystemEvent('api.repository.afterCreate', [$model, true]);

return $model;
}
Expand All @@ -112,7 +112,7 @@ public function update($id, array $attributes = [])
}
});

$this->fireSystemEvent('api.repository.afterUpdate', [$model, TRUE]);
$this->fireSystemEvent('api.repository.afterUpdate', [$model, true]);

return $model;
}
Expand Down
4 changes: 2 additions & 2 deletions classes/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public function callAction($action, $parameters = [])
public function checkAction($action)
{
if (!array_key_exists($action, $this->allowedActions))
return FALSE;
return false;

if (!$methodExists = $this->methodExists($action))
return FALSE;
return false;

if ($ownMethod = method_exists($this, $action)) {
$methodInfo = new \ReflectionMethod($this, $action);
Expand Down
2 changes: 1 addition & 1 deletion config/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

return [

'debug' => env('API_DEBUG', TRUE),
'debug' => env('API_DEBUG', true),

/*
|--------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class MakePrimaryKeyBigintAllTables extends Migration
public function up()
{
Schema::table('igniter_api_resources', function (Blueprint $table) {
$table->unsignedBigInteger('id', TRUE)->change();
$table->unsignedBigInteger('id', true)->change();
});
}

Expand Down
2 changes: 1 addition & 1 deletion models/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public static function syncAll()
$model->controller = array_get($definition, 'controller');
/** @var TYPE_NAME $model */
$model->meta = array_except(array_get($definition, 'options'), 'names');
$model->is_custom = FALSE;
$model->is_custom = false;
$model->save();
}
}
Expand Down
2 changes: 1 addition & 1 deletion models/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function can($ability)
$ability = [$ability];

if (in_array('*', $this->abilities))
return TRUE;
return true;

$diff = array_diff_key(array_flip($ability), array_flip($this->abilities));

Expand Down
8 changes: 4 additions & 4 deletions models/config/resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
],
'name' => [
'name' => 'lang:igniter.api::default.column_api_name',
'searchable' => TRUE,
'searchable' => true,
],
'base_endpoint' => [
'label' => 'lang:igniter.api::default.column_base_endpoint',
'sortable' => FALSE,
'sortable' => false,
],
'description' => [
'label' => 'lang:igniter.api::default.column_description',
Expand Down Expand Up @@ -73,7 +73,7 @@
'type' => 'text',
'span' => 'right',
'comment' => 'lang:igniter.api::default.label_description_comment',
'commentHtml' => TRUE,
'commentHtml' => true,
],
'endpoint' => [
'label' => 'lang:igniter.api::default.label_base_endpoint',
Expand All @@ -85,7 +85,7 @@
'label' => 'lang:igniter.api::default.label_controller',
'type' => 'text',
'span' => 'right',
'disabled' => TRUE,
'disabled' => true,
],
'meta' => [
'label' => 'lang:igniter.api::default.label_actions',
Expand Down
6 changes: 3 additions & 3 deletions models/config/token.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'columns' => [
'tokenable_id' => [
'label' => 'lang:igniter.api::default.column_issued_to',
'searchable' => TRUE,
'searchable' => true,
'formatter' => function ($record, $column, $value) {
$value = $record->tokenable_type == 'users'
? $record->tokenable->username : $record->tokenable->email;
Expand All @@ -33,14 +33,14 @@
],
'tokenable_type' => [
'label' => 'lang:igniter.api::default.column_token_type',
'searchable' => TRUE,
'searchable' => true,
'formatter' => function ($record, $column, $value) {
return $value == 'users' ? lang('igniter.api::default.text_token_type_staff') : lang('igniter.api::default.text_token_type_customer');
},
],
'name' => [
'label' => 'lang:igniter.api::default.column_device_name',
'searchable' => TRUE,
'searchable' => true,
],
'created_at' => [
'label' => 'lang:igniter.api::default.column_created',
Expand Down

0 comments on commit 6c29d13

Please sign in to comment.