diff --git a/app/Auth/PassportSocialResolver.php b/app/Auth/PassportSocialResolver.php index 8f89da2..e87226b 100644 --- a/app/Auth/PassportSocialResolver.php +++ b/app/Auth/PassportSocialResolver.php @@ -1,5 +1,7 @@ @@ -14,7 +16,6 @@ class GenerateDocumentationCommand extends Command { - protected const APIDOCS_FILENAME = 'apidoc.json'; protected array $docInputs = [ @@ -28,14 +29,14 @@ class GenerateDocumentationCommand extends Command * * @var string */ - protected $signature = "apidocs {--vrbs : Verbose of apidoc}"; + protected $signature = 'apidocs {--vrbs : Verbose of apidoc}'; /** * The console command description. * * @var string */ - protected $description = "Generate API Blueprint Documentation."; + protected $description = 'Generate API Blueprint Documentation.'; public function __construct() { @@ -49,16 +50,13 @@ public function __construct() ]; } - /** - * Execute the console command. - * - */ + /** Execute the console command. */ public function handle() { $this->info('Generating API Blueprint Documentation ...'); $path = $this->config['output'].$this->config['url'].'/generated-markdown'; - if (!file_exists($path)) { + if ( ! file_exists($path)) { app('files')->makeDirectory($path, $mode = 0777, true, true); } @@ -80,7 +78,7 @@ private function generateHeader($path, $fileName) $replacer('{{api.domain.dev}}', config('app.url')); $replacer( '{{accept-header}}', - "application/json" + 'application/json' ); $replacer('{{rate-limit-expires}}', config('setting.api.throttle.expires')); $replacer('{{rate-limit-attempts}}', config('setting.api.throttle.limit')); @@ -139,7 +137,7 @@ private function generateAPIDocsTask() // execute the command $process->run(); - if (!$process->isSuccessful()) { + if ( ! $process->isSuccessful()) { throw new ProcessFailedException($process); } // $this->info('Result: ' . $process->getOutput()); @@ -150,4 +148,4 @@ private function getJsonConfigurationPath() $template = str_replace(base_path(), '', $this->config['documentFilePath']); return substr($template, 1, strlen($template) - 1).'config/'; } -} \ No newline at end of file +} diff --git a/app/Console/Commands/Inspiring.php b/app/Console/Commands/Inspiring.php index 1217b9f..7a4285e 100644 --- a/app/Console/Commands/Inspiring.php +++ b/app/Console/Commands/Inspiring.php @@ -1,5 +1,7 @@ comment("\n".self::quote()."\n"); } -} \ No newline at end of file +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index a9ec377..6606bf6 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -1,5 +1,7 @@ getMessage(), $exception ); - } elseif (!config('app.debug') && $exception instanceof QueryException) { + } elseif ( ! config('app.debug') && $exception instanceof QueryException) { $exception = new HttpException(Response::HTTP_UNPROCESSABLE_ENTITY, 'Something wrong with your query'); } diff --git a/app/Helper.php b/app/Helper.php index 98a57f2..543f818 100644 --- a/app/Helper.php +++ b/app/Helper.php @@ -1,5 +1,7 @@ getAttribute(PDO::ATTR_DRIVER_NAME) === 'mysql') && version_compare($pdo->getAttribute(PDO::ATTR_SERVER_VERSION), '5.7.8', 'ge'); } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index ef8052e..131fd0a 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -1,5 +1,7 @@ getRouteKeyName()) + Rule::exists(config('permission.models.role'), app(config('permission.models.role'))->getRouteKeyName()) ]; } private function userRules(): array { return [ - 'required', Rule::exists(User::class,(new User())->getRouteKeyName()) + 'required', Rule::exists(User::class, (new User())->getRouteKeyName()) ]; } @@ -517,7 +518,7 @@ private function permissionRules(): array { return [ 'required', - Rule::exists(config('permission.models.permission'),app(config('permission.models.permission'))->getRouteKeyName()) + Rule::exists(config('permission.models.permission'), app(config('permission.models.permission'))->getRouteKeyName()) ]; } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/V1/Backend/Auth/Permission/PermissionController.php b/app/Http/Controllers/V1/Backend/Auth/Permission/PermissionController.php index 8fde4d8..0ac3290 100644 --- a/app/Http/Controllers/V1/Backend/Auth/Permission/PermissionController.php +++ b/app/Http/Controllers/V1/Backend/Auth/Permission/PermissionController.php @@ -1,5 +1,7 @@ middleware('permission:'.$permissions['show'], ['only' => 'show']); $this->middleware('permission:'.$permissions['update'], ['only' => 'update']); $this->middleware('permission:'.$permissions['destroy'], ['only' => 'destroy']); - } /** @@ -43,7 +43,8 @@ public function index(Request $request) QueryBuilder::for(config('permission.models.role')) ->allowedFilters('name') ->paginate(), - new RoleTransformer()); + new RoleTransformer() + ); } /** @@ -91,7 +92,8 @@ public function show(Request $request, string $id) { return $this->fractal( app(FindRoleByRouteKeyAction::class)->execute($id), - new RoleTransformer()); + new RoleTransformer() + ); } /** @@ -159,4 +161,4 @@ public function destroy(string $id) return response('', 204); } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/V1/Backend/Auth/User/UserController.php b/app/Http/Controllers/V1/Backend/Auth/User/UserController.php index 2ed7b42..60c8983 100644 --- a/app/Http/Controllers/V1/Backend/Auth/User/UserController.php +++ b/app/Http/Controllers/V1/Backend/Auth/User/UserController.php @@ -1,5 +1,7 @@ allowedFilters(['first_name', 'last_name', 'email']) ->paginate(), - new UserTransformer()); + new UserTransformer() + ); } /** @@ -61,7 +63,8 @@ public function show(string $id) { return $this->fractal( app(FindUserByRouteKeyAction::class)->execute($id, throw404: true), - new UserTransformer()); + new UserTransformer() + ); } /** @@ -95,7 +98,8 @@ public function store(Request $request) return $this->fractal( app(CreateUserAction::class)->execute($attributes), - new UserTransformer()) + new UserTransformer() + ) ->respond(201); } @@ -140,7 +144,6 @@ public function update(Request $request, string $id) return $this->fractal($user->refresh(), new UserTransformer()); } - /** * @param string $id * diff --git a/app/Http/Controllers/V1/Backend/Auth/User/UserDeleteController.php b/app/Http/Controllers/V1/Backend/Auth/User/UserDeleteController.php index 4b35654..d21bcd4 100644 --- a/app/Http/Controllers/V1/Backend/Auth/User/UserDeleteController.php +++ b/app/Http/Controllers/V1/Backend/Auth/User/UserDeleteController.php @@ -1,8 +1,9 @@ allowedFilters(['first_name', 'last_name', 'email']) ->paginate(), - new UserTransformer()); + new UserTransformer() + ); } /** @@ -85,4 +86,4 @@ public function purge(string $id) return response('', 204); } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/V1/Frontend/User/UserAccessController.php b/app/Http/Controllers/V1/Frontend/User/UserAccessController.php index 05ab3a9..7612e6b 100644 --- a/app/Http/Controllers/V1/Frontend/User/UserAccessController.php +++ b/app/Http/Controllers/V1/Frontend/User/UserAccessController.php @@ -1,5 +1,7 @@ fractal(auth()->user(), new UserTransformer()); } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/V1/LocalizationController.php b/app/Http/Controllers/V1/LocalizationController.php index ac84718..a040fa0 100644 --- a/app/Http/Controllers/V1/LocalizationController.php +++ b/app/Http/Controllers/V1/LocalizationController.php @@ -1,5 +1,7 @@ $value) { // it is a simple key - if (!is_array($value)) { + if ( ! is_array($value)) { $localizations->push(new Localization($value)); } else { // it is a composite key $localizations->push(new Localization($key, $value)); @@ -43,4 +45,4 @@ public function index() return $this->fractal($localizations, new LocalizationTransformer()); } -} \ No newline at end of file +} diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index 19658f6..82cba2e 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -1,5 +1,7 @@ @@ -24,7 +26,7 @@ class LocalizationMiddleware { /** * @param \Illuminate\Http\Request $request - * @param \Closure $next + * @param Closure $next * * @return mixed */ @@ -89,9 +91,7 @@ private function validateLanguage($requestLanguages) return null; } - /** - * @return array - */ + /** @return array */ private function getSupportedLanguages() { $supported_locales = []; @@ -100,7 +100,7 @@ private function getSupportedLanguages() foreach ($locales as $key => $value) { // it is a "simple" language code (e.g., "en")! - if (!is_array($value)) { + if ( ! is_array($value)) { $supported_locales[] = $value; } @@ -127,4 +127,4 @@ private function getLocale(Request $request): string ? $request->header('Accept-Language') : config('app.locale'); } -} \ No newline at end of file +} diff --git a/app/Jobs/Job.php b/app/Jobs/Job.php index 0dc6bfd..f01cb4b 100644 --- a/app/Jobs/Job.php +++ b/app/Jobs/Job.php @@ -1,5 +1,7 @@ @@ -38,7 +40,6 @@ */ class Permission extends \Spatie\Permission\Models\Permission { - /** * all permissions * @@ -48,4 +49,4 @@ class Permission extends \Spatie\Permission\Models\Permission 'index' => 'permission index', 'show' => 'permission show', ]; -} \ No newline at end of file +} diff --git a/app/Models/Auth/Role/Role.php b/app/Models/Auth/Role/Role.php index 44ae021..62c2c23 100644 --- a/app/Models/Auth/Role/Role.php +++ b/app/Models/Auth/Role/Role.php @@ -1,4 +1,6 @@ @@ -35,7 +37,6 @@ */ class Role extends \Spatie\Permission\Models\Role { - /** * all permissions * @@ -48,4 +49,4 @@ class Role extends \Spatie\Permission\Models\Role 'update' => 'role update', 'destroy' => 'role destroy', ]; -} \ No newline at end of file +} diff --git a/app/Models/Auth/User/SocialAccount.php b/app/Models/Auth/User/SocialAccount.php index 03bef68..a7e0600 100644 --- a/app/Models/Auth/User/SocialAccount.php +++ b/app/Models/Auth/User/SocialAccount.php @@ -1,5 +1,7 @@ $this->id, 'provider' => $provider, 'provider_id' => $providerId, ] - : [ + : [ 'user_id' => $this->id, 'provider' => $provider, ] - )->get()->count() > 0; + )->get()->count() > 0; } public function getSocialAccountButtons() @@ -111,7 +113,7 @@ public function updateAvatar(string $avatarTypeFormInput, UploadedFile $uploaded case 'social': /** @var \App\Models\Auth\SocialAccount $social */ $social = $this->socialAccounts->first(); - if (!blank($social)) { + if ( ! blank($social)) { $this->update( [ 'avatar_type' => $social->provider, diff --git a/app/Models/Auth/User/Traits/UserRelationships.php b/app/Models/Auth/User/Traits/UserRelationships.php index ac58a14..2fe8200 100644 --- a/app/Models/Auth/User/Traits/UserRelationships.php +++ b/app/Models/Auth/User/Traits/UserRelationships.php @@ -1,5 +1,7 @@ hasMany(SocialAccount::class); diff --git a/app/Models/Auth/User/User.php b/app/Models/Auth/User/User.php index c02d614..99c4197 100644 --- a/app/Models/Auth/User/User.php +++ b/app/Models/Auth/User/User.php @@ -1,5 +1,7 @@ 'user purge', 'restore' => 'user restore', // status -// 'update status' => 'user update status', -// 'deactivated list' => 'user deactivated list', + // 'update status' => 'user update status', + // 'deactivated list' => 'user deactivated list', ]; /** diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 4d131e0..1d5b0a3 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -1,5 +1,7 @@ app->router, [ -// 'prefix' => 'v1/oauth', + // 'prefix' => 'v1/oauth', 'middleware' => 'throttle:30,30', ] ); @@ -39,4 +41,4 @@ public function boot() { $this->app->bind(SocialUserResolverInterface::class, PassportSocialResolver::class); } -} \ No newline at end of file +} diff --git a/app/Providers/Macros/BluePrintMaxin.php b/app/Providers/Macros/BluePrintMaxin.php index 22f44e3..5820d25 100644 --- a/app/Providers/Macros/BluePrintMaxin.php +++ b/app/Providers/Macros/BluePrintMaxin.php @@ -1,5 +1,7 @@ $type($column); }; } -} \ No newline at end of file +} diff --git a/app/Transformers/Auth/PermissionTransformer.php b/app/Transformers/Auth/PermissionTransformer.php index 9ed628e..3e41ca2 100644 --- a/app/Transformers/Auth/PermissionTransformer.php +++ b/app/Transformers/Auth/PermissionTransformer.php @@ -1,4 +1,6 @@ @@ -28,9 +30,7 @@ public function transform(Permission $permission) ]; } - /** - * @return string - */ + /** @return string */ public function getResourceKey(): string { return 'permissions'; diff --git a/app/Transformers/Auth/RoleTransformer.php b/app/Transformers/Auth/RoleTransformer.php index 2ebe064..e7c44c7 100644 --- a/app/Transformers/Auth/RoleTransformer.php +++ b/app/Transformers/Auth/RoleTransformer.php @@ -1,4 +1,6 @@ @@ -37,9 +39,7 @@ public function includePermissions(Role $role) return $this->collection($role->permissions, new PermissionTransformer()); } - /** - * @return string - */ + /** @return string */ public function getResourceKey(): string { return 'roles'; diff --git a/app/Transformers/Auth/UserTransformer.php b/app/Transformers/Auth/UserTransformer.php index 9c9e3b5..d3e930c 100644 --- a/app/Transformers/Auth/UserTransformer.php +++ b/app/Transformers/Auth/UserTransformer.php @@ -1,4 +1,6 @@ @@ -82,9 +84,7 @@ public function includePermissions(User $user) return $this->collection($user->permissions, new PermissionTransformer()); } - /** - * @return string - */ + /** @return string */ public function getResourceKey(): string { return 'users'; diff --git a/app/Transformers/BaseTransformer.php b/app/Transformers/BaseTransformer.php index 543fb29..ba0cf47 100644 --- a/app/Transformers/BaseTransformer.php +++ b/app/Transformers/BaseTransformer.php @@ -1,4 +1,6 @@ @@ -21,14 +23,14 @@ abstract public function getResourceKey(): string; protected static function forId(Model $model): string { - return $model->{$model->getRouteKeyName()}; + return (string) $model->{$model->getRouteKeyName()}; } protected static function filterData(array $response, array $data, array $roleNames = null): array { if (app('auth')->check() && app('auth')->user()->hasAnyRole( - is_null($roleNames) ? config('setting.permission.role_names.system') : $roleNames - )) { + is_null($roleNames) ? config('setting.permission.role_names.system') : $roleNames + )) { return array_merge($response, $data); } @@ -43,11 +45,11 @@ protected static function addTimesHumanReadable( ): array { $auth = app('auth'); - if (!$auth->check()) { + if ( ! $auth->check()) { return $responseData; } - if (!$auth->user()->hasAnyRole(config('setting.permission.role_names'))) { + if ( ! $auth->user()->hasAnyRole(config('setting.permission.role_names'))) { return $responseData; } @@ -56,7 +58,7 @@ protected static function addTimesHumanReadable( $defaults = ['created_at', 'updated_at', 'deleted_at']; // only custom - if ($isHasCustom && !$isIncludeDefault) { + if ($isHasCustom && ! $isIncludeDefault) { $toBeConvert = $columns; } // custom and defaults elseif ($isHasCustom && $isIncludeDefault) { @@ -70,7 +72,7 @@ protected static function addTimesHumanReadable( foreach ($toBeConvert as $column) { $return = array_merge( $return, - (!is_null($entity->{$column})) ? array_merge($return, self::readableTimestamp($column, $entity)) : [] + ( ! is_null($entity->{$column})) ? array_merge($return, self::readableTimestamp($column, $entity)) : [] ); } @@ -107,4 +109,4 @@ protected function collection($data, $transformer, ?string $resourceKey = null): { return parent::collection($data, $transformer, $resourceKey ?: $transformer->getResourceKey()); } -} \ No newline at end of file +} diff --git a/app/Transformers/LocalizationTransformer.php b/app/Transformers/LocalizationTransformer.php index ae57833..82e131f 100644 --- a/app/Transformers/LocalizationTransformer.php +++ b/app/Transformers/LocalizationTransformer.php @@ -1,4 +1,6 @@ @@ -59,11 +61,9 @@ public function transform(Localization $entity) return $response; } - /** - * @return string - */ + /** @return string */ public function getResourceKey(): string { return 'localizations'; } -} \ No newline at end of file +} diff --git a/app/Values/Localizations/Localization.php b/app/Values/Localizations/Localization.php index 4a37f7d..c388aa8 100644 --- a/app/Values/Localizations/Localization.php +++ b/app/Values/Localizations/Localization.php @@ -1,4 +1,6 @@ @@ -32,35 +34,27 @@ public function __construct($language, array $regions = []) } } - /** - * @return string - */ + /** @return string */ public function getDefaultName() { return Locale::getDisplayLanguage($this->language, config('app.locale')); } - /** - * @return string - */ + /** @return string */ public function getLocaleName() { return Locale::getDisplayLanguage($this->language, $this->language); } - /** - * @return string|null - */ + /** @return string|null */ public function getLanguage() { return $this->language; } - /** - * @return array - */ + /** @return array */ public function getRegions() { return $this->regions; } -} \ No newline at end of file +} diff --git a/app/Values/Localizations/Region.php b/app/Values/Localizations/Region.php index 1de1d73..69d2578 100644 --- a/app/Values/Localizations/Region.php +++ b/app/Values/Localizations/Region.php @@ -1,4 +1,6 @@ @@ -25,27 +27,21 @@ public function __construct($region) $this->region = $region; } - /** - * @return string - */ + /** @return string */ public function getDefaultName() { return Locale::getDisplayRegion($this->region, config('app.locale')); } - /** - * @return string - */ + /** @return string */ public function getLocaleName() { return Locale::getDisplayRegion($this->region, $this->region); } - /** - * @return string|null - */ + /** @return string|null */ public function getRegion() { return $this->region; } -} \ No newline at end of file +} diff --git a/app/Values/Value.php b/app/Values/Value.php index 0b47846..83f229a 100644 --- a/app/Values/Value.php +++ b/app/Values/Value.php @@ -1,4 +1,6 @@ @@ -8,7 +10,6 @@ namespace App\Values; - abstract class Value { -} \ No newline at end of file +} diff --git a/bootstrap/app.php b/bootstrap/app.php index 5f065a3..d64b020 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,5 +1,7 @@ configure('setting'); $app->configure('swagger-lume'); - $app->alias('mail.manager', Illuminate\Mail\MailManager::class); $app->alias('mail.manager', Illuminate\Contracts\Mail\Factory::class); diff --git a/composer.json b/composer.json index 57d73ea..3a77cd6 100644 --- a/composer.json +++ b/composer.json @@ -47,6 +47,7 @@ "beyondcode/tinkerwell-helper": "^1.3", "doctrine/dbal": "^3.2", "fakerphp/faker": "^1.13", + "laravel/pint": "^1.2", "mockery/mockery": "^1.4.4", "pestphp/pest": "^1.21.1", "spatie/laravel-ray": "^1.26.3", @@ -90,7 +91,9 @@ ], "test": "./vendor/bin/pest", "test-coverage": "./vendor/bin/pest --coverage", - "x-ray": "vendor/bin/x-ray app database domain resources routes tests" + "x-ray": "vendor/bin/x-ray app database domain resources routes tests", + "format": "vendor/bin/pint", + "format-dry-run": "vendor/bin/pint --test" }, "config": { "preferred-install": "dist", diff --git a/composer.lock b/composer.lock index ae0c65c..6430b6b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1f3216c081c0b1225cce630632ad489d", + "content-hash": "11bcc977bcb38315b718b880bbe3ac8f", "packages": [ { "name": "brick/math", @@ -9912,6 +9912,72 @@ }, "time": "2020-07-09T08:09:16+00:00" }, + { + "name": "laravel/pint", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/laravel/pint.git", + "reference": "1d276e4c803397a26cc337df908f55c2a4e90d86" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/pint/zipball/1d276e4c803397a26cc337df908f55c2a4e90d86", + "reference": "1d276e4c803397a26cc337df908f55c2a4e90d86", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "ext-tokenizer": "*", + "ext-xml": "*", + "php": "^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.11.0", + "illuminate/view": "^9.27", + "laravel-zero/framework": "^9.1.3", + "mockery/mockery": "^1.5.0", + "nunomaduro/larastan": "^2.2", + "nunomaduro/termwind": "^1.14.0", + "pestphp/pest": "^1.22.1" + }, + "bin": [ + "builds/pint" + ], + "type": "project", + "autoload": { + "psr-4": { + "App\\": "app/", + "Database\\Seeders\\": "database/seeders/", + "Database\\Factories\\": "database/factories/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "An opinionated code formatter for PHP.", + "homepage": "https://laravel.com", + "keywords": [ + "format", + "formatter", + "lint", + "linter", + "php" + ], + "support": { + "issues": "https://github.com/laravel/pint/issues", + "source": "https://github.com/laravel/pint" + }, + "time": "2022-09-13T15:07:15+00:00" + }, { "name": "mockery/mockery", "version": "1.5.1", diff --git a/database/factories/Auth/User/UserFactory.php b/database/factories/Auth/User/UserFactory.php index d6118a0..8fba8bb 100644 --- a/database/factories/Auth/User/UserFactory.php +++ b/database/factories/Auth/User/UserFactory.php @@ -1,12 +1,13 @@ app('hash')->make('secret'), ]; } -} \ No newline at end of file +} diff --git a/database/factories/BaseFactory.php b/database/factories/BaseFactory.php index 34eca6c..d751380 100644 --- a/database/factories/BaseFactory.php +++ b/database/factories/BaseFactory.php @@ -1,5 +1,7 @@ app()->getNamespace(). + $resolver = fn (self $factory) => app()->getNamespace(). 'Models\\'. str_replace(class_basename($factory), '', str_replace(self::$namespace, '', static::class)). Str::replaceLast('Factory', '', class_basename($factory)); diff --git a/database/migrations/2018_01_01_000000_create_permission_tables.php b/database/migrations/2018_01_01_000000_create_permission_tables.php index f20ef75..9453dc2 100644 --- a/database/migrations/2018_01_01_000000_create_permission_tables.php +++ b/database/migrations/2018_01_01_000000_create_permission_tables.php @@ -1,5 +1,7 @@ unsignedBigInteger($columnNames['team_foreign_key']); $table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index'); - $table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'], - 'model_has_permissions_permission_model_type_primary'); + $table->primary( + [$columnNames['team_foreign_key'], PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'], + 'model_has_permissions_permission_model_type_primary' + ); } else { - $table->primary([PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'], - 'model_has_permissions_permission_model_type_primary'); + $table->primary( + [PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'], + 'model_has_permissions_permission_model_type_primary' + ); } - }); Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) { @@ -89,11 +94,15 @@ public function up() $table->unsignedBigInteger($columnNames['team_foreign_key']); $table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index'); - $table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'], - 'model_has_roles_role_model_type_primary'); + $table->primary( + [$columnNames['team_foreign_key'], PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'], + 'model_has_roles_role_model_type_primary' + ); } else { - $table->primary([PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'], - 'model_has_roles_role_model_type_primary'); + $table->primary( + [PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'], + 'model_has_roles_role_model_type_primary' + ); } }); diff --git a/database/migrations/2018_11_24_055350_create_users_table.php b/database/migrations/2018_11_24_055350_create_users_table.php index eefeda6..fbd2d90 100644 --- a/database/migrations/2018_11_24_055350_create_users_table.php +++ b/database/migrations/2018_11_24_055350_create_users_table.php @@ -1,5 +1,7 @@ unsignedBigInteger($columnNames['team_foreign_key'])->nullable(); $table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index'); } }); Schema::table($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) { - if (! Schema::hasColumn($tableNames['model_has_permissions'], $columnNames['team_foreign_key'])) { - $table->unsignedBigInteger($columnNames['team_foreign_key'])->default('1');; + if ( ! Schema::hasColumn($tableNames['model_has_permissions'], $columnNames['team_foreign_key'])) { + $table->unsignedBigInteger($columnNames['team_foreign_key'])->default('1'); $table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index'); $table->dropPrimary(); - $table->primary([$columnNames['team_foreign_key'], 'permission_id', $columnNames['model_morph_key'], 'model_type'], - 'model_has_permissions_permission_model_type_primary'); + $table->primary( + [$columnNames['team_foreign_key'], 'permission_id', $columnNames['model_morph_key'], 'model_type'], + 'model_has_permissions_permission_model_type_primary' + ); } }); Schema::table($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) { - if (! Schema::hasColumn($tableNames['model_has_roles'], $columnNames['team_foreign_key'])) { - $table->unsignedBigInteger($columnNames['team_foreign_key'])->default('1');; + if ( ! Schema::hasColumn($tableNames['model_has_roles'], $columnNames['team_foreign_key'])) { + $table->unsignedBigInteger($columnNames['team_foreign_key'])->default('1'); $table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index'); $table->dropPrimary(); - $table->primary([$columnNames['team_foreign_key'], 'role_id', $columnNames['model_morph_key'], 'model_type'], - 'model_has_roles_role_model_type_primary'); + $table->primary( + [$columnNames['team_foreign_key'], 'role_id', $columnNames['model_morph_key'], 'model_type'], + 'model_has_roles_role_model_type_primary' + ); } }); @@ -68,6 +74,5 @@ public function up() */ public function down() { - } } diff --git a/database/seeders/Auth/AuthSeeder.php b/database/seeders/Auth/AuthSeeder.php index 05e6476..be5ed29 100644 --- a/database/seeders/Auth/AuthSeeder.php +++ b/database/seeders/Auth/AuthSeeder.php @@ -1,5 +1,7 @@ givePermissionTo($permission); if ($isAddToAdminRole) { - if (!in_array($permissionName, $except)) { + if ( ! in_array($permissionName, $except)) { $roleModel::findByName(config('setting.permission.role_names.admin'))->givePermissionTo( $permission ); @@ -25,4 +27,4 @@ public function seederPermission(array $permissionNames, bool $isAddToAdminRole } } } -} \ No newline at end of file +} diff --git a/domain/Auth/Actions/FindPermissionByRouteKeyAction.php b/domain/Auth/Actions/FindPermissionByRouteKeyAction.php index 76c26ad..63187ea 100644 --- a/domain/Auth/Actions/FindPermissionByRouteKeyAction.php +++ b/domain/Auth/Actions/FindPermissionByRouteKeyAction.php @@ -1,5 +1,7 @@ getRouteKeyName(), $routeKey + app($permission)->getRouteKeyName(), + $routeKey )->first(); } -} \ No newline at end of file +} diff --git a/domain/Auth/Actions/FindRoleByRouteKeyAction.php b/domain/Auth/Actions/FindRoleByRouteKeyAction.php index 4cf7ea8..fcb833c 100644 --- a/domain/Auth/Actions/FindRoleByRouteKeyAction.php +++ b/domain/Auth/Actions/FindRoleByRouteKeyAction.php @@ -1,5 +1,7 @@ getRouteKeyName(), $routeKey + app($role)->getRouteKeyName(), + $routeKey )->first(); } -} \ No newline at end of file +} diff --git a/domain/User/Actions/CreateUserAction.php b/domain/User/Actions/CreateUserAction.php index 25a92e9..b6426d4 100644 --- a/domain/User/Actions/CreateUserAction.php +++ b/domain/User/Actions/CreateUserAction.php @@ -1,5 +1,7 @@ first(); } -} \ No newline at end of file +} diff --git a/domain/User/Actions/FindUserByRouteKeyOnlyTrashAction.php b/domain/User/Actions/FindUserByRouteKeyOnlyTrashAction.php index f31d2ad..4065465 100644 --- a/domain/User/Actions/FindUserByRouteKeyOnlyTrashAction.php +++ b/domain/User/Actions/FindUserByRouteKeyOnlyTrashAction.php @@ -1,5 +1,7 @@ first(); } -} \ No newline at end of file +} diff --git a/pint.json b/pint.json new file mode 100644 index 0000000..706cbd5 --- /dev/null +++ b/pint.json @@ -0,0 +1,69 @@ +{ + "preset": "psr12", + "exclude": [ + "config", + "build" + ], + "notPath": [ + "ray.php" + ], + "rules": { + "declare_strict_types": true, + "align_multiline_comment": true, + "array_indentation": true, + "array_syntax": true, + "assign_null_coalescing_to_coalesce_equal": true, + "cast_spaces": true, + "clean_namespace": true, + "combine_consecutive_issets": true, + "combine_consecutive_unsets": true, + "doctrine_annotation_indentation": true, + "doctrine_annotation_spaces": true, + "fully_qualified_strict_types": true, + "function_typehint_space": true, + "global_namespace_import": true, + "heredoc_indentation": true, + "include": true, + "lambda_not_used_import": true, + "linebreak_after_opening_tag": true, + "list_syntax": true, + "magic_constant_casing": true, + "magic_method_casing": true, + "method_chaining_indentation": true, + "multiline_comment_opening_closing": true, + "multiline_whitespace_before_semicolons": true, + "native_function_casing": true, + "native_function_type_declaration_casing": true, + "no_alias_language_construct_call": true, + "no_alternative_syntax": true, + "no_empty_comment": true, + "no_empty_statement": true, + "no_extra_blank_lines": true, + "no_leading_namespace_whitespace": true, + "no_mixed_echo_print": true, + "no_multiline_whitespace_around_double_arrow": true, + "no_multiple_statements_per_line": true, + "no_singleline_whitespace_before_semicolons": true, + "no_spaces_around_offset": true, + "no_unneeded_import_alias": true, + "no_unused_imports": true, + "no_whitespace_before_comma_in_array": true, + "no_whitespace_in_blank_line": true, + "not_operator_with_space": true, + "php_unit_fqcn_annotation": true, + "phpdoc_line_span": { + "const": "single", + "method": "single", + "property": "single" + }, + "phpdoc_scalar": true, + "simple_to_complex_string_variable": true, + "simplified_if_return": true, + "single_quote": true, + "standardize_not_equals": true, + "trim_array_spaces": true, + "types_spaces": true, + "unary_operator_spaces": true, + "whitespace_after_comma_in_array": true + } +} diff --git a/public/index.php b/public/index.php index 04aa086..8ce12f8 100644 --- a/public/index.php +++ b/public/index.php @@ -1,5 +1,7 @@ env('APP_NAME', 'Welcome to Lumen Boilerplate').'أهلا بك في ', diff --git a/resources/lang/ar/validation.php b/resources/lang/ar/validation.php index b7d508c..b062fd4 100755 --- a/resources/lang/ar/validation.php +++ b/resources/lang/ar/validation.php @@ -1,5 +1,7 @@ 'Welcome to Lumen Boilerplate (GB)', diff --git a/resources/lang/en/messages.php b/resources/lang/en/messages.php index 25fa714..1f17e47 100644 --- a/resources/lang/en/messages.php +++ b/resources/lang/en/messages.php @@ -1,5 +1,7 @@ 'Welcome to Lumen Boilerplate', diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index e1ca6a4..1d82d24 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -1,5 +1,7 @@ 'Bienvenido a Lumen Boilerplate', diff --git a/resources/lang/es/validation.php b/resources/lang/es/validation.php index 6b4dffb..336fc11 100644 --- a/resources/lang/es/validation.php +++ b/resources/lang/es/validation.php @@ -1,5 +1,7 @@ 'Bienvenue chez Lumen Boilerplate', diff --git a/resources/lang/fr/validation.php b/resources/lang/fr/validation.php index efde3da..0bce764 100644 --- a/resources/lang/fr/validation.php +++ b/resources/lang/fr/validation.php @@ -1,5 +1,7 @@ 'Добродошли у ' . env('APP_NAME', 'Добродошл у Лумен Боилерплате'), diff --git a/resources/lang/sr-Cyrl-RS/validation.php b/resources/lang/sr-Cyrl-RS/validation.php index 04e12fd..07ba93c 100644 --- a/resources/lang/sr-Cyrl-RS/validation.php +++ b/resources/lang/sr-Cyrl-RS/validation.php @@ -1,5 +1,7 @@ 'Dobrodošli u ' . env('APP_NAME', 'Dobrodošli u Lumen Boilerplate'), diff --git a/resources/lang/sr-Latn-RS/validation.php b/resources/lang/sr-Latn-RS/validation.php index 04952c4..b0f79f3 100644 --- a/resources/lang/sr-Latn-RS/validation.php +++ b/resources/lang/sr-Latn-RS/validation.php @@ -1,5 +1,7 @@ group( @@ -13,4 +15,4 @@ function () use ($router) { include 'permission.php'; include 'authorization.php'; } -); \ No newline at end of file +); diff --git a/routes/v1/backend/auth/authorization.php b/routes/v1/backend/auth/authorization.php index 88a0ea2..6fe3712 100644 --- a/routes/v1/backend/auth/authorization.php +++ b/routes/v1/backend/auth/authorization.php @@ -1,5 +1,7 @@ group( @@ -57,4 +59,4 @@ function () use ($router) { ] ); } -); \ No newline at end of file +); diff --git a/routes/v1/backend/auth/permission.php b/routes/v1/backend/auth/permission.php index 524b576..f509323 100644 --- a/routes/v1/backend/auth/permission.php +++ b/routes/v1/backend/auth/permission.php @@ -1,5 +1,7 @@ group( @@ -25,4 +27,4 @@ function () use ($router) { ] ); } -); \ No newline at end of file +); diff --git a/routes/v1/backend/auth/role.php b/routes/v1/backend/auth/role.php index 570bdd6..ab2a5c2 100644 --- a/routes/v1/backend/auth/role.php +++ b/routes/v1/backend/auth/role.php @@ -1,5 +1,7 @@ group( @@ -46,4 +48,4 @@ function () use ($router) { ] ); } -); \ No newline at end of file +); diff --git a/routes/v1/backend/auth/user.php b/routes/v1/backend/auth/user.php index 0e64656..58d1493 100644 --- a/routes/v1/backend/auth/user.php +++ b/routes/v1/backend/auth/user.php @@ -1,5 +1,7 @@ group( @@ -75,4 +77,4 @@ function () use ($router) { } ); } -); \ No newline at end of file +); diff --git a/routes/v1/backend/backend.php b/routes/v1/backend/backend.php index 1de5fb1..d8aa57d 100644 --- a/routes/v1/backend/backend.php +++ b/routes/v1/backend/backend.php @@ -1,17 +1,18 @@ group( [ - 'middleware' => - [ - 'auth', - 'permission:'.config('setting.permission.permission_names.view_backend'), -// 'api.throttle', -// 'api.auth', -// 'serializer', - ], + 'middleware' => [ + 'auth', + 'permission:'.config('setting.permission.permission_names.view_backend'), + // 'api.throttle', + // 'api.auth', + // 'serializer', + ], 'namespace' => 'Backend', 'as' => 'backend', ], @@ -19,4 +20,4 @@ function () use ($router) { include 'auth/auth.php'; include 'log.php'; } -); \ No newline at end of file +); diff --git a/routes/v1/backend/log.php b/routes/v1/backend/log.php index 99f607d..0cd3029 100644 --- a/routes/v1/backend/log.php +++ b/routes/v1/backend/log.php @@ -1,5 +1,7 @@ get('logs', '\Rap2hpoutre\LaravelLogViewer\LogViewerController@index'); \ No newline at end of file +$router->get('logs', '\Rap2hpoutre\LaravelLogViewer\LogViewerController@index'); diff --git a/routes/v1/frontend/frontend.php b/routes/v1/frontend/frontend.php index b62f816..c720405 100644 --- a/routes/v1/frontend/frontend.php +++ b/routes/v1/frontend/frontend.php @@ -1,18 +1,19 @@ group( [ 'namespace' => 'Frontend', 'as' => 'frontend', - 'middleware' => - [ - 'auth', -// 'api.throttle', -// 'api.auth', -// 'serializer', - ], + 'middleware' => [ + 'auth', + // 'api.throttle', + // 'api.auth', + // 'serializer', + ], ], function () use ($router) { include 'user/user.php'; diff --git a/routes/v1/frontend/user/user.php b/routes/v1/frontend/user/user.php index b5792bd..d6964c2 100644 --- a/routes/v1/frontend/user/user.php +++ b/routes/v1/frontend/user/user.php @@ -1,5 +1,7 @@ group( @@ -8,7 +10,7 @@ 'as' => 'users', ], function () use ($router) { -// Access + // Access $router->get( '/profile', [ @@ -17,4 +19,4 @@ function () use ($router) { ] ); } -); \ No newline at end of file +); diff --git a/routes/v1/localization.php b/routes/v1/localization.php index 6aa3caa..cd164c6 100644 --- a/routes/v1/localization.php +++ b/routes/v1/localization.php @@ -1,5 +1,7 @@ get( @@ -7,4 +9,4 @@ [ 'uses' => 'LocalizationController@index', ] -); \ No newline at end of file +); diff --git a/routes/v1/v1.php b/routes/v1/v1.php index 403ae52..571f8f3 100644 --- a/routes/v1/v1.php +++ b/routes/v1/v1.php @@ -1,5 +1,7 @@ group( @@ -10,4 +12,4 @@ function () use ($router) { include 'frontend/frontend.php'; include 'backend/backend.php'; } -); \ No newline at end of file +); diff --git a/routes/web.php b/routes/web.php index 122ccfd..4c2ece7 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,7 +1,8 @@ group( [ diff --git a/tests/Auth/Authorization/BaseRole.php b/tests/Auth/Authorization/BaseRole.php index 27523da..7febf13 100644 --- a/tests/Auth/Authorization/BaseRole.php +++ b/tests/Auth/Authorization/BaseRole.php @@ -1,4 +1,6 @@ @@ -99,5 +101,4 @@ protected function createPermission($name = 'test permission name'): Permission ] ); } - -} \ No newline at end of file +} diff --git a/tests/Auth/Authorization/ManageTest.php b/tests/Auth/Authorization/ManageTest.php index d06d394..bcab4e0 100644 --- a/tests/Auth/Authorization/ManageTest.php +++ b/tests/Auth/Authorization/ManageTest.php @@ -1,4 +1,6 @@ @@ -12,7 +14,7 @@ uses(Test\Auth\Authorization\BaseRole::class); -beforeEach(fn() => $this->loggedInAs()); +beforeEach(fn () => $this->loggedInAs()); it('assign role to user', function () { $user = UserFactory::new()->create(); @@ -137,4 +139,4 @@ assertFalse($role->refresh()->hasPermissionTo($permission)); // $this->seeJsonApiRelation($permission, 'permissions', 'dontSeeJson'); // $this->showModelWithRelation('backend.roles.show', $role, $permission, 'permissions', 'dontSeeJson'); -}); \ No newline at end of file +}); diff --git a/tests/Auth/Authorization/PermissionAccessTest.php b/tests/Auth/Authorization/PermissionAccessTest.php index 0856c96..5282e8e 100644 --- a/tests/Auth/Authorization/PermissionAccessTest.php +++ b/tests/Auth/Authorization/PermissionAccessTest.php @@ -1,4 +1,6 @@ @@ -9,7 +11,7 @@ uses(Test\Auth\Authorization\BaseRole::class); it('access', function ($method, $uri, $roleName, $statusCode) { - if (! empty($roleName)) { + if ( ! empty($roleName)) { $this->loggedInAs($roleName); } @@ -35,4 +37,4 @@ // guest 'index by guest' => ['get', 'permissions', '', 401], 'show by guest' => ['get', 'permissions/{id}', '', 401], - ]); \ No newline at end of file + ]); diff --git a/tests/Auth/Authorization/RoleAccessTest.php b/tests/Auth/Authorization/RoleAccessTest.php index 5f4f365..d8abf4f 100644 --- a/tests/Auth/Authorization/RoleAccessTest.php +++ b/tests/Auth/Authorization/RoleAccessTest.php @@ -1,4 +1,6 @@ @@ -9,7 +11,7 @@ uses(Test\Auth\Authorization\BaseRole::class); it('access', function ($method, $uri, $roleName, $statusCode) { - if (! empty($roleName)) { + if ( ! empty($roleName)) { $this->loggedInAs($roleName); } @@ -60,4 +62,4 @@ 'show by guest' => ['get', 'roles/{id}', '', 401], 'update by guest' => ['put', 'roles/{id}', '', 401], 'destroy by guest' => ['delete', 'roles/{id}', '', 401], -]); \ No newline at end of file +]); diff --git a/tests/Auth/Authorization/RoleManagementTest.php b/tests/Auth/Authorization/RoleManagementTest.php index 25c5814..28a54a1 100644 --- a/tests/Auth/Authorization/RoleManagementTest.php +++ b/tests/Auth/Authorization/RoleManagementTest.php @@ -1,4 +1,6 @@ @@ -40,8 +42,8 @@ ); }) ->with([ - ["store"], - ["update"], + ['store'], + ['update'], ]); it('default role not allowed', function ($verbMethod, $routeName) { @@ -64,8 +66,8 @@ ); }) ->with([ - ["delete", "backend.roles.destroy"], - ["put", "backend.roles.update"], + ['delete', 'backend.roles.destroy'], + ['put', 'backend.roles.update'], ]); it('store role success', function () { @@ -153,4 +155,4 @@ 'message' => "A role `$roleNameTest` already exists for guard `api`.", ] ); -}); \ No newline at end of file +}); diff --git a/tests/Auth/User/BasicResourceFailedTest.php b/tests/Auth/User/BasicResourceFailedTest.php index ee262a8..f50e0f4 100644 --- a/tests/Auth/User/BasicResourceFailedTest.php +++ b/tests/Auth/User/BasicResourceFailedTest.php @@ -1,5 +1,7 @@ $hashedId]), $this->addHeaders()); assertResponseStatus(404); -}); \ No newline at end of file +}); diff --git a/tests/Auth/User/BasicResourceSuccessTest.php b/tests/Auth/User/BasicResourceSuccessTest.php index 034bfeb..219323a 100644 --- a/tests/Auth/User/BasicResourceSuccessTest.php +++ b/tests/Auth/User/BasicResourceSuccessTest.php @@ -1,4 +1,6 @@ @@ -76,4 +78,4 @@ $data = $this->userData(); unset($data['password']); seeJson($data); -}); \ No newline at end of file +}); diff --git a/tests/Auth/User/DeleteResourceFailedTest.php b/tests/Auth/User/DeleteResourceFailedTest.php index 5624831..882016a 100644 --- a/tests/Auth/User/DeleteResourceFailedTest.php +++ b/tests/Auth/User/DeleteResourceFailedTest.php @@ -1,4 +1,6 @@ diff --git a/tests/Auth/User/DeleteResourceSuccessTest.php b/tests/Auth/User/DeleteResourceSuccessTest.php index c39ec9e..19650a8 100644 --- a/tests/Auth/User/DeleteResourceSuccessTest.php +++ b/tests/Auth/User/DeleteResourceSuccessTest.php @@ -1,4 +1,6 @@ @@ -51,4 +53,4 @@ 'id' => $user->id, ] ); -}); \ No newline at end of file +}); diff --git a/tests/Auth/User/UserAccessTest.php b/tests/Auth/User/UserAccessTest.php index 2a95c31..0a1e370 100644 --- a/tests/Auth/User/UserAccessTest.php +++ b/tests/Auth/User/UserAccessTest.php @@ -1,4 +1,6 @@ @@ -9,7 +11,7 @@ use Database\Factories\Auth\User\UserFactory; it('access', function ($method, $uri, $roleName, $statusCode) { - if (! empty($roleName)) { + if ( ! empty($roleName)) { $this->loggedInAs($roleName); } diff --git a/tests/Auth/User/UserProfileTest.php b/tests/Auth/User/UserProfileTest.php index f706cfc..d272a40 100644 --- a/tests/Auth/User/UserProfileTest.php +++ b/tests/Auth/User/UserProfileTest.php @@ -1,4 +1,6 @@ @@ -7,7 +9,7 @@ */ test('get profile', function ($roleName, $status) { - if (! empty($roleName)) { + if ( ! empty($roleName)) { $userData = collect($this->loggedInAs($roleName))->only( [ 'first_name', @@ -18,14 +20,14 @@ } get(route('frontend.users.profile'), $this->addHeaders()); - if (! empty($roleName)) { + if ( ! empty($roleName)) { seeJson($userData); } assertResponseStatus($status); }) ->with([ - ["system", 200], - ["admin", 200], - ["user", 200], - ["", 401], + ['system', 200], + ['admin', 200], + ['user', 200], + ['', 401], ]); diff --git a/tests/Auth/User/UserValidationTest.php b/tests/Auth/User/UserValidationTest.php index c22d20f..b68fc08 100644 --- a/tests/Auth/User/UserValidationTest.php +++ b/tests/Auth/User/UserValidationTest.php @@ -1,4 +1,6 @@ @@ -39,4 +41,4 @@ 'email' => ['The email has already been taken.'], ] ); -}); \ No newline at end of file +}); diff --git a/tests/BaseUrlTest.php b/tests/BaseUrlTest.php index db322a7..24e56d0 100644 --- a/tests/BaseUrlTest.php +++ b/tests/BaseUrlTest.php @@ -1,4 +1,6 @@ @@ -19,4 +21,4 @@ 'message' => 'Welcome to Lumen Boilerplate', ] ); -}); \ No newline at end of file +}); diff --git a/tests/LocaleTest.php b/tests/LocaleTest.php index c193168..2dde14b 100644 --- a/tests/LocaleTest.php +++ b/tests/LocaleTest.php @@ -1,4 +1,6 @@ @@ -9,7 +11,7 @@ use function PHPUnit\Framework\assertEquals; test('get all', function () { -// login(); + // login(); get( 'localizations', [ @@ -25,7 +27,7 @@ 'Accept' => 'application/x.lumen.boilerplate.v1+json', ]; - if (! is_null($locale)) { + if ( ! is_null($locale)) { $headers['Accept-Language'] = $locale; } @@ -36,7 +38,7 @@ seeJson( [ 'message' => 'Unsupported Language.', -// 'status_code' => 412, + // 'status_code' => 412, ] ); return; @@ -44,10 +46,10 @@ $message = 'Welcome to Lumen Boilerplate'; switch ($locale) { - case'xxx,fr'; - $locale = 'fr'; - $message = 'Bienvenue chez Lumen Boilerplate'; - break; + case'xxx,fr': + $locale = 'fr'; + $message = 'Bienvenue chez Lumen Boilerplate'; + break; default: $locale = $locale ?: config('app.locale'); break; @@ -61,8 +63,8 @@ ); }) ->with([ - ["en"], + ['en'], [null], - ["xxx"], - ["xxx,fr"], - ]); \ No newline at end of file + ['xxx'], + ['xxx,fr'], + ]); diff --git a/tests/Pest.php b/tests/Pest.php index 31f2864..9024d68 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -1,5 +1,7 @@ response; -//} \ No newline at end of file +//} diff --git a/tests/TestCase.php b/tests/TestCase.php index 57302cd..671144e 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,5 +1,7 @@ {$model->getRouteKeyName()}; + return (string) $model->{$model->getRouteKeyName()}; } protected function setUp(): void @@ -64,7 +66,7 @@ protected function addHeaders(array $headers = [], bool $isServer = false) $headers += [ 'Accept' => 'application/x.lumen.boilerplate.v1+json', 'Authorization' => 'Bearer xxxxx', -// 'Accept-Language' =>'en', + // 'Accept-Language' =>'en', ]; return $isServer diff --git a/tests/UsesDatabase.php b/tests/UsesDatabase.php index 3143295..a719c77 100644 --- a/tests/UsesDatabase.php +++ b/tests/UsesDatabase.php @@ -1,5 +1,7 @@ database); } - /** - * Refresh the database to a clean version. - */ + /** Refresh the database to a clean version. */ public function refreshDatabase(): void { if (File::exists($this->databaseCopy)) {