From 9443ac181c7450892d0736c87d447ac0c44134b2 Mon Sep 17 00:00:00 2001 From: = Date: Mon, 11 May 2026 07:42:09 +0000 Subject: [PATCH] chore: format and refactor the Connected Service component to use dto collection --- app/Actions/Fortify/CreateNewUser.php | 5 +- app/Actions/Fortify/ResetUserPassword.php | 2 +- .../ConnectedServiceCollectionData.php | 14 --- .../ConnectedServiceData.php | 9 +- .../ConnectedServicesData.php | 18 ---- app/Data/Ui/ManageRoles/RoleData.php | 7 +- app/Livewire/Actions/Logout.php | 3 +- app/Livewire/Settings/Profile.php | 3 +- app/Livewire/Settings/Security.php | 16 ++-- app/Models/User.php | 6 +- app/Providers/AppServiceProvider.php | 5 +- app/Providers/FortifyServiceProvider.php | 24 +++-- app/Providers/ScopeServiceProvider.php | 13 ++- app/View/Components/Table.php | 14 ++- bootstrap/app.php | 7 +- config/cache.php | 2 +- config/data.php | 89 ++++++++----------- config/database.php | 2 +- config/filesystems.php | 2 +- config/logging.php | 6 +- config/session.php | 2 +- database/factories/UserFactory.php | 6 +- .../0001_01_01_000000_create_users_table.php | 3 +- .../0001_01_01_000001_create_cache_table.php | 3 +- .../0001_01_01_000002_create_jobs_table.php | 3 +- ..._add_two_factor_columns_to_users_table.php | 3 +- pint.json | 70 +++++---------- public/index.php | 6 +- .../connected-services/⚡all.blade.php | 14 ++- .../dashboard/roles/⚡manager.blade.php | 3 +- routes/settings.php | 4 +- routes/web.php | 2 +- tests/Feature/Auth/EmailVerificationTest.php | 7 +- tests/Pest.php | 2 +- tests/TestCase.php | 2 +- 35 files changed, 141 insertions(+), 236 deletions(-) delete mode 100644 app/Data/Ui/ConnectedServices/ConnectedServiceCollectionData.php delete mode 100644 app/Data/Ui/ConnectedServices/ConnectedServicesData.php diff --git a/app/Actions/Fortify/CreateNewUser.php b/app/Actions/Fortify/CreateNewUser.php index 3bdcd16..94b76a3 100644 --- a/app/Actions/Fortify/CreateNewUser.php +++ b/app/Actions/Fortify/CreateNewUser.php @@ -4,8 +4,7 @@ namespace App\Actions\Fortify; -use App\Concerns\PasswordValidationRules; -use App\Concerns\ProfileValidationRules; +use App\Concerns\{PasswordValidationRules, ProfileValidationRules}; use App\Models\User; use Illuminate\Support\Facades\Validator; use Laravel\Fortify\Contracts\CreatesNewUsers; @@ -18,7 +17,7 @@ final class CreateNewUser implements CreatesNewUsers /** * Validate and create a newly registered user. * - * @param array $input + * @param array $input */ public function create(array $input): User { diff --git a/app/Actions/Fortify/ResetUserPassword.php b/app/Actions/Fortify/ResetUserPassword.php index 82d9f0f..e9af5c7 100644 --- a/app/Actions/Fortify/ResetUserPassword.php +++ b/app/Actions/Fortify/ResetUserPassword.php @@ -16,7 +16,7 @@ final class ResetUserPassword implements ResetsUserPasswords /** * Validate and reset the user's forgotten password. * - * @param array $input + * @param array $input */ public function reset(User $user, array $input): void { diff --git a/app/Data/Ui/ConnectedServices/ConnectedServiceCollectionData.php b/app/Data/Ui/ConnectedServices/ConnectedServiceCollectionData.php deleted file mode 100644 index 68539b7..0000000 --- a/app/Data/Ui/ConnectedServices/ConnectedServiceCollectionData.php +++ /dev/null @@ -1,14 +0,0 @@ - - */ -final class ConnectedServiceCollectionData extends Collection {} diff --git a/app/Data/Ui/ConnectedServices/ConnectedServiceData.php b/app/Data/Ui/ConnectedServices/ConnectedServiceData.php index 2b2c10e..aa5fecf 100644 --- a/app/Data/Ui/ConnectedServices/ConnectedServiceData.php +++ b/app/Data/Ui/ConnectedServices/ConnectedServiceData.php @@ -4,16 +4,11 @@ namespace App\Data\Ui\ConnectedServices; -use App\Enums\ConnectionStatus; -use App\Enums\ConnectionTechTypes; -use Livewire\Wireable; -use Spatie\LaravelData\Concerns\WireableData; +use App\Enums\{ConnectionStatus, ConnectionTechTypes}; use Spatie\LaravelData\Data; -final class ConnectedServiceData extends Data implements Wireable +final class ConnectedServiceData extends Data { - use WireableData; - public function __construct( public string $name, public string $icon, diff --git a/app/Data/Ui/ConnectedServices/ConnectedServicesData.php b/app/Data/Ui/ConnectedServices/ConnectedServicesData.php deleted file mode 100644 index fe99811..0000000 --- a/app/Data/Ui/ConnectedServices/ConnectedServicesData.php +++ /dev/null @@ -1,18 +0,0 @@ - */ - #[DataCollectionOf(class: UserData::class),] + #[DataCollectionOf(class: UserData::class), ] public DataCollection $users, /** @var DataCollection */ - #[DataCollectionOf(class: ServiceData::class),] + #[DataCollectionOf(class: ServiceData::class), ] public DataCollection $services, public RolesStatus $status, ) {} diff --git a/app/Livewire/Actions/Logout.php b/app/Livewire/Actions/Logout.php index 9f0143e..68685d4 100644 --- a/app/Livewire/Actions/Logout.php +++ b/app/Livewire/Actions/Logout.php @@ -4,8 +4,7 @@ namespace App\Livewire\Actions; -use Illuminate\Support\Facades\Auth; -use Illuminate\Support\Facades\Session; +use Illuminate\Support\Facades\{Auth, Session}; final class Logout { diff --git a/app/Livewire/Settings/Profile.php b/app/Livewire/Settings/Profile.php index 537debc..376d60a 100644 --- a/app/Livewire/Settings/Profile.php +++ b/app/Livewire/Settings/Profile.php @@ -8,8 +8,7 @@ use Flux\Flux; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Support\Facades\Auth; -use Livewire\Attributes\Computed; -use Livewire\Attributes\Title; +use Livewire\Attributes\{Computed, Title}; use Livewire\Component; #[Title('Profile settings')] diff --git a/app/Livewire/Settings/Security.php b/app/Livewire/Settings/Security.php index bb6e3e7..75597ec 100644 --- a/app/Livewire/Settings/Security.php +++ b/app/Livewire/Settings/Security.php @@ -9,15 +9,9 @@ use Flux\Flux; use Illuminate\Support\Facades\Auth; use Illuminate\Validation\ValidationException; -use Laravel\Fortify\Actions\ConfirmTwoFactorAuthentication; -use Laravel\Fortify\Actions\DisableTwoFactorAuthentication; -use Laravel\Fortify\Actions\EnableTwoFactorAuthentication; -use Laravel\Fortify\Features; -use Laravel\Fortify\Fortify; -use Livewire\Attributes\Computed; -use Livewire\Attributes\Locked; -use Livewire\Attributes\Title; -use Livewire\Attributes\Validate; +use Laravel\Fortify\Actions\{ConfirmTwoFactorAuthentication, DisableTwoFactorAuthentication, EnableTwoFactorAuthentication}; +use Laravel\Fortify\{Features, Fortify}; +use Livewire\Attributes\{Computed, Locked, Title, Validate}; use Livewire\Component; #[Title('Security settings')] @@ -102,7 +96,7 @@ public function enable(EnableTwoFactorAuthentication $enableTwoFactorAuthenticat { $enableTwoFactorAuthentication(auth()->user()); - if ( ! $this->requiresConfirmation) { + if (! $this->requiresConfirmation) { $this->twoFactorEnabled = auth()->user()->hasEnabledTwoFactorAuthentication(); } @@ -176,7 +170,7 @@ public function closeModal(): void $this->resetErrorBag(); - if ( ! $this->requiresConfirmation) { + if (! $this->requiresConfirmation) { $this->twoFactorEnabled = auth()->user()->hasEnabledTwoFactorAuthentication(); } } diff --git a/app/Models/User.php b/app/Models/User.php index 76d30cb..60066a0 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -6,8 +6,7 @@ // use Illuminate\Contracts\Auth\MustVerifyEmail; use Database\Factories\UserFactory; -use Illuminate\Database\Eloquent\Attributes\Fillable; -use Illuminate\Database\Eloquent\Attributes\Hidden; +use Illuminate\Database\Eloquent\Attributes\{Fillable, Hidden}; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; @@ -20,6 +19,7 @@ final class User extends Authenticatable { /** @use HasFactory */ use HasFactory; + use Notifiable; use TwoFactorAuthenticatable; @@ -31,7 +31,7 @@ public function initials(): string return Str::of($this->name) ->explode(' ') ->take(2) - ->map(fn($word) => Str::substr($word, 0, 1)) + ->map(fn ($word) => Str::substr($word, 0, 1)) ->implode(''); } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index a1d2a27..03d09ba 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -5,8 +5,7 @@ namespace App\Providers; use Carbon\CarbonImmutable; -use Illuminate\Support\Facades\Date; -use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\{DB, Date}; use Illuminate\Support\ServiceProvider; use Illuminate\Validation\Rules\Password; @@ -37,7 +36,7 @@ protected function configureDefaults(): void ); Password::defaults( - fn(): ?Password => app()->isProduction() + fn (): ?Password => app()->isProduction() ? Password::min(12) ->mixedCase() ->letters() diff --git a/app/Providers/FortifyServiceProvider.php b/app/Providers/FortifyServiceProvider.php index e8bde16..bb51beb 100644 --- a/app/Providers/FortifyServiceProvider.php +++ b/app/Providers/FortifyServiceProvider.php @@ -4,13 +4,11 @@ namespace App\Providers; -use App\Actions\Fortify\CreateNewUser; -use App\Actions\Fortify\ResetUserPassword; +use App\Actions\Fortify\{CreateNewUser, ResetUserPassword}; use Illuminate\Cache\RateLimiting\Limit; use Illuminate\Http\Request; use Illuminate\Support\Facades\RateLimiter; -use Illuminate\Support\ServiceProvider; -use Illuminate\Support\Str; +use Illuminate\Support\{ServiceProvider, Str}; use Laravel\Fortify\Fortify; final class FortifyServiceProvider extends ServiceProvider @@ -44,13 +42,13 @@ private function configureActions(): void */ private function configureViews(): void { - Fortify::loginView(fn() => view('livewire.auth.login')); - Fortify::verifyEmailView(fn() => view('livewire.auth.verify-email')); - Fortify::twoFactorChallengeView(fn() => view('livewire.auth.two-factor-challenge')); - Fortify::confirmPasswordView(fn() => view('livewire.auth.confirm-password')); - Fortify::registerView(fn() => view('livewire.auth.register')); - Fortify::resetPasswordView(fn() => view('livewire.auth.reset-password')); - Fortify::requestPasswordResetLinkView(fn() => view('livewire.auth.forgot-password')); + Fortify::loginView(fn () => view('livewire.auth.login')); + Fortify::verifyEmailView(fn () => view('livewire.auth.verify-email')); + Fortify::twoFactorChallengeView(fn () => view('livewire.auth.two-factor-challenge')); + Fortify::confirmPasswordView(fn () => view('livewire.auth.confirm-password')); + Fortify::registerView(fn () => view('livewire.auth.register')); + Fortify::resetPasswordView(fn () => view('livewire.auth.reset-password')); + Fortify::requestPasswordResetLinkView(fn () => view('livewire.auth.forgot-password')); } /** @@ -58,10 +56,10 @@ private function configureViews(): void */ private function configureRateLimiting(): void { - RateLimiter::for('two-factor', fn(Request $request) => Limit::perMinute(5)->by($request->session()->get('login.id'))); + RateLimiter::for('two-factor', fn (Request $request) => Limit::perMinute(5)->by($request->session()->get('login.id'))); RateLimiter::for('login', function (Request $request) { - $throttleKey = Str::transliterate(Str::lower($request->input(Fortify::username())) . '|' . $request->ip()); + $throttleKey = Str::transliterate(Str::lower($request->input(Fortify::username())).'|'.$request->ip()); return Limit::perMinute(5)->by($throttleKey); }); diff --git a/app/Providers/ScopeServiceProvider.php b/app/Providers/ScopeServiceProvider.php index f2e1765..392d750 100644 --- a/app/Providers/ScopeServiceProvider.php +++ b/app/Providers/ScopeServiceProvider.php @@ -4,9 +4,8 @@ namespace App\Providers; -use Illuminate\Support\Arr; +use Illuminate\Support\{Arr, ServiceProvider}; use Illuminate\Support\Facades\Blade; -use Illuminate\Support\ServiceProvider; final class ScopeServiceProvider extends ServiceProvider { @@ -26,10 +25,10 @@ public function registerScopeDirective(): void * * https://github.com/konradkalemba/blade-components-scoped-slots */ - Blade::directive("scope", function ($expression) { + Blade::directive('scope', function ($expression) { // Split the expression by `top-level` commas (not in parentheses) $directiveArguments = preg_split("/,(?![^\(\(]*[\)\)])/", $expression); - $directiveArguments = array_map("trim", $directiveArguments); + $directiveArguments = array_map('trim', $directiveArguments); // PHP 8.5 Safe Unpacking (Prevents "Undefined array key" crashes) $name = $directiveArguments[0] ?? "''"; @@ -40,7 +39,7 @@ public function registerScopeDirective(): void $uses = array_flip($uses); $uses[] = '$__env'; $uses[] = '$__bladeCompiler'; - $uses = implode(",", $uses); + $uses = implode(',', $uses); /** * Slot names can`t contains dot , eg: `user.city`. @@ -48,12 +47,12 @@ public function registerScopeDirective(): void * * Later, on component it will be replaced back. */ - $name = str_replace(".", "___", $name); + $name = str_replace('.', '___', $name); // PHP 8.5 Safe Loop Check return "slot({$name}, function({$functionArguments}) use ({$uses}) { \$loop = !empty(\$__env->getLoopStack()) ? (object) \$__env->getLoopStack()[0] : null; ?>"; }); - Blade::directive("endscope", fn() => ""); + Blade::directive('endscope', fn () => ''); } } diff --git a/app/View/Components/Table.php b/app/View/Components/Table.php index ad03812..8a34bfd 100644 --- a/app/View/Components/Table.php +++ b/app/View/Components/Table.php @@ -6,9 +6,7 @@ use Closure; use Illuminate\Contracts\View\View; -use Illuminate\Support\Arr; -use Illuminate\Support\Carbon; -use Illuminate\Support\Str; +use Illuminate\Support\{Arr, Carbon, Str}; use Illuminate\View\Component; final class Table extends Component @@ -44,10 +42,8 @@ public function __construct( // Remove closures from serialization unset($this->rowDecoration, $this->cellDecoration, $this->headers); - - // Serialize a unique ID for component tracking - $this->uuid = "table-" . md5(serialize($this)) . $id; + $this->uuid = 'table-'.md5(serialize($this)).$id; // Restore closures $this->rowDecoration = $rowDecoration; @@ -66,7 +62,7 @@ public function format(mixed $row, mixed $field, mixed $header): mixed { $format = $header['format'] ?? null; - if ( ! $format) { + if (! $format) { return $field; } @@ -75,7 +71,7 @@ public function format(mixed $row, mixed $field, mixed $header): mixed } if ('currency' === $format[0]) { - return ($format[2] ?? '') . number_format((float) $field, ...mb_str_split($format[1])); + return ($format[2] ?? '').number_format((float) $field, ...mb_str_split($format[1])); } if ('date' === $format[0] && $field) { @@ -104,7 +100,7 @@ public function redirectLink(mixed $row): string // Replace tokens with actual row values $tokens->each(function (string $token) use ($row, &$link): void { - $link = Str::of($link)->replace("{" . $token . "}", data_get($row, $token))->toString(); + $link = Str::of($link)->replace('{'.$token.'}', data_get($row, $token))->toString(); }); return $link; diff --git a/bootstrap/app.php b/bootstrap/app.php index 944f4a5..b645e1c 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -3,13 +3,12 @@ declare(strict_types=1); use Illuminate\Foundation\Application; -use Illuminate\Foundation\Configuration\Exceptions; -use Illuminate\Foundation\Configuration\Middleware; +use Illuminate\Foundation\Configuration\{Exceptions, Middleware}; return Application::configure(basePath: dirname(__DIR__)) ->withRouting( - web: __DIR__ . '/../routes/web.php', - commands: __DIR__ . '/../routes/console.php', + web: __DIR__.'/../routes/web.php', + commands: __DIR__.'/../routes/console.php', health: '/up', ) ->withMiddleware(function (Middleware $middleware): void {}) diff --git a/config/cache.php b/config/cache.php index 62c6b58..fe80299 100644 --- a/config/cache.php +++ b/config/cache.php @@ -114,7 +114,7 @@ | */ - 'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')) . '-cache-'), + 'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'), /* |-------------------------------------------------------------------------- diff --git a/config/data.php b/config/data.php index d32c999..bad2d17 100644 --- a/config/data.php +++ b/config/data.php @@ -3,22 +3,11 @@ declare(strict_types=1); use Illuminate\Contracts\Support\Arrayable; -use Spatie\LaravelData\Casts\DateTimeInterfaceCast; -use Spatie\LaravelData\Casts\EnumCast; -use Spatie\LaravelData\Normalizers\ArrayableNormalizer; -use Spatie\LaravelData\Normalizers\ArrayNormalizer; -use Spatie\LaravelData\Normalizers\JsonNormalizer; -use Spatie\LaravelData\Normalizers\ModelNormalizer; -use Spatie\LaravelData\Normalizers\ObjectNormalizer; -use Spatie\LaravelData\RuleInferrers\AttributesRuleInferrer; -use Spatie\LaravelData\RuleInferrers\BuiltInTypesRuleInferrer; -use Spatie\LaravelData\RuleInferrers\NullableRuleInferrer; -use Spatie\LaravelData\RuleInferrers\RequiredRuleInferrer; -use Spatie\LaravelData\RuleInferrers\SometimesRuleInferrer; +use Spatie\LaravelData\Casts\{DateTimeInterfaceCast, EnumCast}; +use Spatie\LaravelData\Normalizers\{ArrayNormalizer, ArrayableNormalizer, JsonNormalizer, ModelNormalizer, ObjectNormalizer}; +use Spatie\LaravelData\RuleInferrers\{AttributesRuleInferrer, BuiltInTypesRuleInferrer, NullableRuleInferrer, RequiredRuleInferrer, SometimesRuleInferrer}; use Spatie\LaravelData\Support\Creation\ValidationStrategy; -use Spatie\LaravelData\Transformers\ArrayableTransformer; -use Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer; -use Spatie\LaravelData\Transformers\EnumTransformer; +use Spatie\LaravelData\Transformers\{ArrayableTransformer, DateTimeInterfaceTransformer, EnumTransformer}; return [ /* @@ -26,36 +15,36 @@ * is an array, it will try to convert from the first format that works, * and will serialize dates using the first format from the array. */ - "date_format" => DATE_ATOM, + 'date_format' => DATE_ATOM, /* * When transforming or casting dates, the following timezone will be used to * convert the date to the correct timezone. If set to null no timezone will * be passed. */ - "date_timezone" => null, + 'date_timezone' => null, /* * It is possible to enable certain features of the package, these would otherwise * be breaking changes, and thus they are disabled by default. In the next major * version of the package, these features will be enabled by default. */ - "features" => [ - "cast_and_transform_iterables" => false, + 'features' => [ + 'cast_and_transform_iterables' => false, /* * When trying to set a computed property value, the package will throw an exception. * You can disable this behaviour by setting this option to true, which will then just * ignore the value being passed into the computed property and recalculate it. */ - "ignore_exception_when_trying_to_set_computed_property_value" => false, + 'ignore_exception_when_trying_to_set_computed_property_value' => false, ], /* * Global transformers will take complex types and transform them into simple * types. */ - "transformers" => [ + 'transformers' => [ DateTimeInterface::class => DateTimeInterfaceTransformer::class, Arrayable::class => ArrayableTransformer::class, BackedEnum::class => EnumTransformer::class, @@ -65,7 +54,7 @@ * Global casts will cast values into complex types when creating a data * object from simple types. */ - "casts" => [ + 'casts' => [ DateTimeInterface::class => DateTimeInterfaceCast::class, BackedEnum::class => EnumCast::class, // Enumerable::class => Spatie\LaravelData\Casts\EnumerableCast::class, @@ -76,7 +65,7 @@ * validation rules to properties of a data object based upon * the type of the property. */ - "rule_inferrers" => [ + 'rule_inferrers' => [ SometimesRuleInferrer::class, NullableRuleInferrer::class, RequiredRuleInferrer::class, @@ -89,7 +78,7 @@ * it cannot normalize the payload. The normalizers below are used for * every data object, unless overridden in a specific data object class. */ - "normalizers" => [ + 'normalizers' => [ ModelNormalizer::class, // Spatie\LaravelData\Normalizers\FormRequestNormalizer::class, ArrayableNormalizer::class, @@ -103,7 +92,7 @@ * this key can be set globally here for all data objects. You can pass in * `null` if you want to disable wrapping. */ - "wrap" => null, + 'wrap' => null, /* * Adds a specific caster to the Symphony VarDumper component which hides @@ -111,7 +100,7 @@ * by `dump` or `dd`. Can be 'enabled', 'disabled' or 'development' * which will only enable the caster locally. */ - "var_dumper_caster_mode" => "development", + 'var_dumper_caster_mode' => 'development', /* * It is possible to skip the PHP reflection analysis of data objects @@ -124,18 +113,18 @@ * in seconds if you want the cache to clear after a certain * timeframe. */ - "structure_caching" => [ - "enabled" => true, - "directories" => [app_path("Data")], - "cache" => [ - "store" => env("CACHE_STORE", env("CACHE_DRIVER", "file")), - "prefix" => "laravel-data", - "duration" => null, + 'structure_caching' => [ + 'enabled' => true, + 'directories' => [app_path('Data')], + 'cache' => [ + 'store' => env('CACHE_STORE', env('CACHE_DRIVER', 'file')), + 'prefix' => 'laravel-data', + 'duration' => null, ], - "reflection_discovery" => [ - "enabled" => true, - "base_path" => base_path(), - "root_namespace" => null, + 'reflection_discovery' => [ + 'enabled' => true, + 'base_path' => base_path(), + 'root_namespace' => null, ], ], @@ -144,23 +133,23 @@ * method. By default, only when a request is passed the data is being validated. This * behaviour can be changed to always validate or to completely disable validation. */ - "validation_strategy" => ValidationStrategy::OnlyRequests->value, + 'validation_strategy' => ValidationStrategy::OnlyRequests->value, /* * A data object can map the names of its properties when transforming (output) or when * creating (input). By default, the package will not map any names. You can set a * global strategy here, or override it on a specific data object. */ - "name_mapping_strategy" => [ - "input" => null, - "output" => null, + 'name_mapping_strategy' => [ + 'input' => null, + 'output' => null, ], /* * When using an invalid include, exclude, only or except partial, the package will * throw an exception. You can disable this behaviour by setting this option to true. */ - "ignore_invalid_partials" => false, + 'ignore_invalid_partials' => false, /* * When transforming a nested chain of data objects, the package can end up in an infinite @@ -168,39 +157,39 @@ * set as a safety measure to prevent this from happening. When set to null, the * package will not enforce a maximum depth. */ - "max_transformation_depth" => null, + 'max_transformation_depth' => null, /* * When the maximum transformation depth is reached, the package will throw an exception. * You can disable this behaviour by setting this option to true which will return an * empty array. */ - "throw_when_max_transformation_depth_reached" => true, + 'throw_when_max_transformation_depth_reached' => true, /* * When using the `make:data` command, the package will use these settings to generate * the data classes. You can override these settings by passing options to the command. */ - "commands" => [ + 'commands' => [ /* * Provides default configuration for the `make:data` command. These settings can be overridden with options * passed directly to the `make:data` command for generating single Data classes, or if not set they will * automatically fall back to these defaults. See `php artisan make:data --help` for more information */ - "make" => [ + 'make' => [ /* * The default namespace for generated Data classes. This exists under the application's root namespace, * so the default 'Data` will end up as '\App\Data', and generated Data classes will be placed in the * app/Data/ folder. Data classes can live anywhere, but this is where `make:data` will put them. */ - "namespace" => "Data", + 'namespace' => 'Data', /* * This suffix will be appended to all data classes generated by make:data, so that they are less likely * to conflict with other related classes, controllers or models with a similar name without resorting * to adding an alias for the Data object. Set to a blank string (not null) to disable. */ - "suffix" => "Data", + 'suffix' => 'Data', ], ], @@ -209,7 +198,7 @@ * these synths will automatically handle the data objects and their * properties when used in a Livewire component. */ - "livewire" => [ - "enable_synths" => true, + 'livewire' => [ + 'enable_synths' => true, ], ]; diff --git a/config/database.php b/config/database.php index df64d23..d588717 100644 --- a/config/database.php +++ b/config/database.php @@ -151,7 +151,7 @@ 'options' => [ 'cluster' => env('REDIS_CLUSTER', 'redis'), - 'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')) . '-database-'), + 'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-'), 'persistent' => env('REDIS_PERSISTENT', false), ], diff --git a/config/filesystems.php b/config/filesystems.php index 7d2bbbe..eeaedcd 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -43,7 +43,7 @@ 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), - 'url' => mb_rtrim(env('APP_URL', 'http://localhost'), '/') . '/storage', + 'url' => mb_rtrim(env('APP_URL', 'http://localhost'), '/').'/storage', 'visibility' => 'public', 'throw' => false, 'report' => false, diff --git a/config/logging.php b/config/logging.php index 7243435..a001964 100644 --- a/config/logging.php +++ b/config/logging.php @@ -2,9 +2,7 @@ declare(strict_types=1); -use Monolog\Handler\NullHandler; -use Monolog\Handler\StreamHandler; -use Monolog\Handler\SyslogUdpHandler; +use Monolog\Handler\{NullHandler, StreamHandler, SyslogUdpHandler}; use Monolog\Processor\PsrLogMessageProcessor; return [ @@ -91,7 +89,7 @@ 'handler_with' => [ 'host' => env('PAPERTRAIL_URL'), 'port' => env('PAPERTRAIL_PORT'), - 'connectionString' => 'tls://' . env('PAPERTRAIL_URL') . ':' . env('PAPERTRAIL_PORT'), + 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), ], 'processors' => [PsrLogMessageProcessor::class], ], diff --git a/config/session.php b/config/session.php index e1ec101..27a721e 100644 --- a/config/session.php +++ b/config/session.php @@ -131,7 +131,7 @@ 'cookie' => env( 'SESSION_COOKIE', - Str::slug((string) env('APP_NAME', 'laravel')) . '-session', + Str::slug((string) env('APP_NAME', 'laravel')).'-session', ), /* diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 32d2c94..5d30b42 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -30,7 +30,7 @@ public function definition(): array 'name' => fake()->name(), 'email' => fake()->unique()->safeEmail(), 'email_verified_at' => now(), - 'password' => static::$password ??= Hash::make('password'), + 'password' => self::$password ??= Hash::make('password'), 'remember_token' => Str::random(10), 'two_factor_secret' => null, 'two_factor_recovery_codes' => null, @@ -43,7 +43,7 @@ public function definition(): array */ public function unverified(): static { - return $this->state(fn(array $attributes) => [ + return $this->state(fn (array $attributes) => [ 'email_verified_at' => null, ]); } @@ -53,7 +53,7 @@ public function unverified(): static */ public function withTwoFactor(): static { - return $this->state(fn(array $attributes) => [ + return $this->state(fn (array $attributes) => [ 'two_factor_secret' => encrypt('secret'), 'two_factor_recovery_codes' => encrypt(json_encode(['recovery-code-1'])), 'two_factor_confirmed_at' => now(), diff --git a/database/migrations/0001_01_01_000000_create_users_table.php b/database/migrations/0001_01_01_000000_create_users_table.php index cfc327e..3edcc61 100644 --- a/database/migrations/0001_01_01_000000_create_users_table.php +++ b/database/migrations/0001_01_01_000000_create_users_table.php @@ -6,7 +6,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class() extends Migration +{ /** * Run the migrations. */ diff --git a/database/migrations/0001_01_01_000001_create_cache_table.php b/database/migrations/0001_01_01_000001_create_cache_table.php index 6c4fbae..e7ffbc3 100644 --- a/database/migrations/0001_01_01_000001_create_cache_table.php +++ b/database/migrations/0001_01_01_000001_create_cache_table.php @@ -6,7 +6,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class() extends Migration +{ /** * Run the migrations. */ diff --git a/database/migrations/0001_01_01_000002_create_jobs_table.php b/database/migrations/0001_01_01_000002_create_jobs_table.php index cf71197..8074e1d 100644 --- a/database/migrations/0001_01_01_000002_create_jobs_table.php +++ b/database/migrations/0001_01_01_000002_create_jobs_table.php @@ -6,7 +6,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class() extends Migration +{ /** * Run the migrations. */ diff --git a/database/migrations/2025_08_14_170933_add_two_factor_columns_to_users_table.php b/database/migrations/2025_08_14_170933_add_two_factor_columns_to_users_table.php index d2f589c..9a8078b 100644 --- a/database/migrations/2025_08_14_170933_add_two_factor_columns_to_users_table.php +++ b/database/migrations/2025_08_14_170933_add_two_factor_columns_to_users_table.php @@ -6,7 +6,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class () extends Migration { +return new class() extends Migration +{ /** * Run the migrations. */ diff --git a/pint.json b/pint.json index 69b94c9..3af04fc 100644 --- a/pint.json +++ b/pint.json @@ -1,21 +1,11 @@ { - "preset": "per", + "preset": "laravel", "rules": { - "align_multiline_comment": true, - "array_indentation": true, - "array_syntax": true, - "blank_line_after_namespace": true, - "blank_line_after_opening_tag": true, - "combine_consecutive_issets": true, - "combine_consecutive_unsets": true, - "concat_space": { - "spacing": "one" - }, - "declare_parentheses": true, "declare_strict_types": true, - "explicit_string_variable": true, "final_class": true, "fully_qualified_strict_types": true, + "group_import": true, + "single_import_per_statement": false, "global_namespace_import": { "import_classes": true, "import_constants": true, @@ -23,14 +13,8 @@ }, "is_null": true, "lambda_not_used_import": true, - "logical_operators": true, - "mb_str_functions": true, - "method_chaining_indentation": true, - "modernize_strpos": true, "new_with_braces": true, "no_empty_comment": true, - "not_operator_with_space": true, - "ordered_traits": true, "protected_to_private": true, "simplified_if_return": true, "strict_comparison": true, @@ -38,7 +22,11 @@ "trim_array_spaces": true, "use_arrow_functions": true, "void_return": true, - "yoda_style": true, + "yoda_style": { + "equal": true, + "identical": true, + "less_and_greater": null + }, "array_push": true, "assign_null_coalescing_to_coalesce_equal": true, "explicit_indirect_variable": true, @@ -49,33 +37,21 @@ "no_superfluous_elseif": true, "no_useless_else": true, "nullable_type_declaration_for_default_null_value": true, - "ordered_imports": { - "sort_algorithm": "alpha" + + "strict_param": true, + "date_time_immutable": true, + "mb_str_functions": true, + "logical_operators": true, + "ordered_interfaces": true, + "ordered_traits": true, + "php_unit_strict": true, + "phpdoc_align": { + "align": "vertical" }, - "ordered_class_elements": { - "order": [ - "use_trait", - "case", - "constant", - "constant_public", - "constant_protected", - "constant_private", - "property_public", - "property_protected", - "property_private", - "construct", - "destruct", - "magic", - "phpunit", - "method_abstract", - "method_public_static", - "method_public", - "method_protected_static", - "method_protected", - "method_private_static", - "method_private" - ], - "sort_algorithm": "none" - } + "phpdoc_separation": true, + "return_type_declaration": { + "space_before": "none" + }, + "single_line_throw": false } } diff --git a/public/index.php b/public/index.php index 7d9e6bf..6aa752c 100644 --- a/public/index.php +++ b/public/index.php @@ -8,15 +8,15 @@ define('LARAVEL_START', microtime(true)); // Determine if the application is in maintenance mode... -if (file_exists($maintenance = __DIR__ . '/../storage/framework/maintenance.php')) { +if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) { require $maintenance; } // Register the Composer autoloader... -require __DIR__ . '/../vendor/autoload.php'; +require __DIR__.'/../vendor/autoload.php'; // Bootstrap Laravel and handle the request... /** @var Application $app */ -$app = require_once __DIR__ . '/../bootstrap/app.php'; +$app = require_once __DIR__.'/../bootstrap/app.php'; $app->handleRequest(Request::capture()); diff --git a/resources/views/components/dashboard/connected-services/⚡all.blade.php b/resources/views/components/dashboard/connected-services/⚡all.blade.php index f7c4d6c..120d0e6 100644 --- a/resources/views/components/dashboard/connected-services/⚡all.blade.php +++ b/resources/views/components/dashboard/connected-services/⚡all.blade.php @@ -1,21 +1,20 @@ connectedServices = new ConnectedServicesData( - services: new ConnectedServiceCollectionData([ + $this->connectedServices = ConnectedServiceData::collect([ new ConnectedServiceData( name: 'Microsoft Outlook', icon: 'home', @@ -44,14 +43,13 @@ public function mount(): void connectionService: 'Redmine', status: ConnectionStatus::Error ), - ]) - ); + ], DataCollection::class); } }; ?>
- @foreach ($connectedServices->services as $service) + @foreach ($connectedServices as $service)
diff --git a/resources/views/components/dashboard/roles/⚡manager.blade.php b/resources/views/components/dashboard/roles/⚡manager.blade.php index 281bac4..61e485c 100644 --- a/resources/views/components/dashboard/roles/⚡manager.blade.php +++ b/resources/views/components/dashboard/roles/⚡manager.blade.php @@ -1,7 +1,6 @@ name('dashboard'); -require __DIR__ . '/settings.php'; +require __DIR__.'/settings.php'; diff --git a/tests/Feature/Auth/EmailVerificationTest.php b/tests/Feature/Auth/EmailVerificationTest.php index 0642168..5943fb1 100644 --- a/tests/Feature/Auth/EmailVerificationTest.php +++ b/tests/Feature/Auth/EmailVerificationTest.php @@ -4,8 +4,7 @@ use App\Models\User; use Illuminate\Auth\Events\Verified; -use Illuminate\Support\Facades\Event; -use Illuminate\Support\Facades\URL; +use Illuminate\Support\Facades\{Event, URL}; use Laravel\Fortify\Features; beforeEach(function (): void { @@ -36,7 +35,7 @@ Event::assertDispatched(Verified::class); expect($user->fresh()->hasVerifiedEmail())->toBeTrue(); - $response->assertRedirect(route('dashboard', absolute: false) . '?verified=1'); + $response->assertRedirect(route('dashboard', absolute: false).'?verified=1'); }); test('email is not verified with invalid hash', function (): void { @@ -67,7 +66,7 @@ ); $this->actingAs($user)->get($verificationUrl) - ->assertRedirect(route('dashboard', absolute: false) . '?verified=1'); + ->assertRedirect(route('dashboard', absolute: false).'?verified=1'); expect($user->fresh()->hasVerifiedEmail())->toBeTrue(); Event::assertNotDispatched(Verified::class); diff --git a/tests/Pest.php b/tests/Pest.php index 4eccbe6..a610e26 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -31,7 +31,7 @@ | */ -expect()->extend('toBeOne', fn() => $this->toBe(1)); +expect()->extend('toBeOne', fn () => $this->toBe(1)); /* |-------------------------------------------------------------------------- diff --git a/tests/TestCase.php b/tests/TestCase.php index f64e620..f16f5d5 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -11,7 +11,7 @@ abstract class TestCase extends BaseTestCase { protected function skipUnlessFortifyHas(string $feature, ?string $message = null): void { - if ( ! Features::enabled($feature)) { + if (! Features::enabled($feature)) { $this->markTestSkipped($message ?? "Fortify feature [{$feature}] is not enabled."); } }