From af4a0e4b0e9886cf7600d278a118df6f204437b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Ioni=C8=9B=C4=83?= Date: Sat, 1 Apr 2023 15:32:35 +0100 Subject: [PATCH] style: apply php-cs-fixer (#318) * style: update php-cs-fixer * style: apply php-cs-fixer --- .php-cs-fixer.dist.php | 18 +-- app/Console/Commands/BlockMakeCommand.php | 4 +- app/Console/Commands/CreateAdminCommand.php | 8 +- app/Console/Commands/SetupCommand.php | 18 +-- .../Commands/UpdateTranslationsCommand.php | 8 +- app/Exports/FormSubmissionsExport.php | 2 +- .../Controllers/Admin/AdminController.php | 18 +-- .../Controllers/Admin/LanguageController.php | 2 +- app/Http/Controllers/Admin/MenuController.php | 16 +-- .../Controllers/Admin/PersonController.php | 2 +- .../Controllers/Admin/SettingController.php | 18 +-- .../Front/DecisionAuthorController.php | 2 +- .../Front/DecisionCategoryController.php | 2 +- .../Controllers/Front/DonationController.php | 18 +-- app/Http/Controllers/Front/PageController.php | 4 +- .../Controllers/Front/PersonController.php | 2 +- .../Front/PostCategoryController.php | 2 +- app/Http/Controllers/Front/PostController.php | 2 +- .../Controllers/Front/SearchController.php | 2 +- app/Http/Middleware/HandleInertiaRequests.php | 20 +-- .../Requests/Admin/DecisionAuthorRequest.php | 6 +- .../Admin/DecisionCategoryRequest.php | 6 +- app/Http/Requests/Admin/DecisionRequest.php | 58 ++++---- app/Http/Requests/Admin/FormRequest.php | 20 +-- app/Http/Requests/Admin/LanguageRequest.php | 6 +- app/Http/Requests/Admin/MenuRequest.php | 8 +- app/Http/Requests/Admin/PageRequest.php | 48 +++---- app/Http/Requests/Admin/PartnerRequest.php | 10 +- app/Http/Requests/Admin/PersonRequest.php | 28 ++-- .../Requests/Admin/PostCategoryRequest.php | 6 +- app/Http/Requests/Admin/PostRequest.php | 30 ++-- app/Http/Requests/Admin/SettingRequest.php | 36 ++--- app/Http/Requests/Admin/UserRequest.php | 6 +- app/Http/Requests/Front/DonationRequest.php | 16 +-- .../Requests/Front/FormSubmissionRequest.php | 18 +-- app/Http/Requests/Front/SearchRequest.php | 2 +- app/Http/Resources/BlockResource.php | 10 +- .../Collections/ResourceCollection.php | 34 ++--- app/Http/Resources/DecisionAuthorResource.php | 20 +-- .../Resources/DecisionCategoryResource.php | 20 +-- app/Http/Resources/DecisionResource.php | 50 +++---- app/Http/Resources/FormResource.php | 56 ++++---- app/Http/Resources/FormSubmissionResource.php | 16 +-- app/Http/Resources/LanguageResource.php | 8 +- app/Http/Resources/MediaResource.php | 18 +-- app/Http/Resources/MenuItemResource.php | 16 +-- app/Http/Resources/PageResource.php | 34 ++--- app/Http/Resources/PartnerResource.php | 34 ++--- app/Http/Resources/PersonResource.php | 36 ++--- app/Http/Resources/PostCategoryResource.php | 20 +-- app/Http/Resources/PostResource.php | 38 ++--- app/Http/Resources/RelatedResource.php | 4 +- app/Http/Resources/UserResource.php | 20 +-- app/Mail/FormSubmitted.php | 4 +- app/Models/Form.php | 2 +- app/Models/Media.php | 6 +- app/Models/MenuItem.php | 8 +- app/Models/Setting.php | 32 ++--- .../Euplatesc/Message/PurchaseRequest.php | 14 +- .../Mobilpay/Message/PurchaseRequest.php | 2 +- app/Providers/AppServiceProvider.php | 38 ++--- app/Providers/SettingsServiceProvider.php | 12 +- app/Services/BlockCollection.php | 6 +- app/Services/Help.php | 14 +- app/Services/SupportsTrait.php | 20 +-- app/Traits/Duplicatable.php | 1 - app/Traits/HasBlocks.php | 28 ++-- app/Traits/HasRelated.php | 4 +- app/Traits/HasSlug.php | 2 +- app/View/Components/Blocks/Carousel.php | 14 +- app/View/Components/Blocks/Html.php | 32 ++--- .../Components/Blocks/ImagesWithLinks.php | 4 +- app/helpers.php | 4 +- config/excel.php | 106 +++++++------- config/website-factory.php | 24 ++-- database/factories/BlockFactory.php | 6 +- .../factories/DecisionCategoryFactory.php | 8 +- database/factories/DecisionFactory.php | 8 +- database/factories/FormFactory.php | 18 +-- database/factories/MenuItemFactory.php | 8 +- database/factories/PageFactory.php | 8 +- database/factories/PartnerFactory.php | 4 +- database/factories/PersonFactory.php | 10 +- database/factories/PostCategoryFactory.php | 8 +- database/factories/PostFactory.php | 8 +- database/factories/UserFactory.php | 12 +- database/seeders/DatabaseSeeder.php | 8 +- lang/en/banner.php | 4 +- lang/en/error.php | 14 +- lang/ro/banner.php | 4 +- lang/ro/error.php | 14 +- lang/ru/banner.php | 4 +- lang/uk/banner.php | 4 +- routes/admin.php | 56 ++++---- tests/Feature/FormTest.php | 132 +++++++++--------- tests/TestCase.php | 8 +- 96 files changed, 808 insertions(+), 821 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 877c958a..e1e6b4f8 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -9,22 +9,10 @@ 'align_multiline_comment' => true, 'array_indentation' => true, 'array_syntax' => ['syntax' => 'short'], - - 'binary_operator_spaces' => [ - 'default' => 'single_space', - 'operators' => ['=>' => null], - ], 'blank_line_after_namespace' => true, 'blank_line_after_opening_tag' => true, - 'blank_line_before_statement' => [ - 'statements' => ['return'], - ], 'braces' => true, 'cast_spaces' => true, - 'class_attributes_separation' => [ - 'elements' => ['method'], - ], - 'class_definition' => true, 'concat_space' => [ 'spacing' => 'one', ], @@ -96,8 +84,7 @@ 'no_singleline_whitespace_before_semicolons' => true, 'no_spaces_after_function_name' => true, 'no_spaces_inside_parenthesis' => true, - 'no_trailing_comma_in_list_call' => true, - 'no_trailing_comma_in_singleline_array' => true, + 'no_trailing_comma_in_singleline' => true, 'no_trailing_whitespace' => true, 'no_trailing_whitespace_in_comment' => true, 'no_unreachable_default_argument_value' => true, @@ -155,7 +142,7 @@ // php-cs-fixer 3: Changed options 'binary_operator_spaces' => [ 'default' => 'single_space', - 'operators' => ['=>' => null], + 'operators' => [], ], 'blank_line_before_statement' => [ 'statements' => ['return'], @@ -194,6 +181,7 @@ __DIR__ . '/app', __DIR__ . '/config', __DIR__ . '/database', + __DIR__ . '/lang', __DIR__ . '/resources', __DIR__ . '/routes', __DIR__ . '/tests', diff --git a/app/Console/Commands/BlockMakeCommand.php b/app/Console/Commands/BlockMakeCommand.php index a6e9487f..f7eae0c8 100644 --- a/app/Console/Commands/BlockMakeCommand.php +++ b/app/Console/Commands/BlockMakeCommand.php @@ -108,7 +108,7 @@ protected function createViewComponent(): void $content = $this->build( base_path('stubs/blocks/view-component.stub'), [ - 'class' => $this->getComponentName(), + 'class' => $this->getComponentName(), ] ); @@ -125,7 +125,7 @@ protected function createVueComponent(): void $content = $this->build( base_path('stubs/blocks/vue.stub'), [ - 'name' => $this->getComponentName(kebabCase: true), + 'name' => $this->getComponentName(kebabCase: true), ] ); diff --git a/app/Console/Commands/CreateAdminCommand.php b/app/Console/Commands/CreateAdminCommand.php index 7fde734a..d65fc14b 100644 --- a/app/Console/Commands/CreateAdminCommand.php +++ b/app/Console/Commands/CreateAdminCommand.php @@ -40,10 +40,10 @@ public function handle() $password = $this->getUserPassword(); User::create([ - 'name' => $name, - 'email' => $email, + 'name' => $name, + 'email' => $email, 'password' => Hash::make($password), - 'role' => 'admin', + 'role' => 'admin', ]); $this->info('The admin account was successfully created!'); @@ -136,7 +136,7 @@ private function validatePassword(?string $password, ?string $confirmation = nul { $validator = Validator::make( [ - 'password' => $password, + 'password' => $password, 'password_confirmation' => $confirmation, ], [ diff --git a/app/Console/Commands/SetupCommand.php b/app/Console/Commands/SetupCommand.php index b495524e..a8f37f6e 100644 --- a/app/Console/Commands/SetupCommand.php +++ b/app/Console/Commands/SetupCommand.php @@ -63,13 +63,13 @@ protected function seedLanguages(): void Language::insert([ [ - 'code' => 'ro', - 'name' => 'Română', + 'code' => 'ro', + 'name' => 'Română', 'enabled' => true, ], [ - 'code' => 'en', - 'name' => 'English', + 'code' => 'en', + 'name' => 'English', 'enabled' => false, ], ]); @@ -107,8 +107,8 @@ protected function seedPages(): void if (\count($setting) === 2) { Setting::create([ 'section' => $setting[0], - 'key' => $setting[1], - 'value' => $page->id, + 'key' => $setting[1], + 'value' => $page->id, ]); } }); @@ -133,10 +133,10 @@ protected function seedAdministrator(): void } User::create([ - 'email' => $email, - 'name' => 'Administrator', + 'email' => $email, + 'name' => 'Administrator', 'password' => Hash::make($password), - 'role' => 'admin', + 'role' => 'admin', ]); $this->info('Successfully created administrator for ' . $email); diff --git a/app/Console/Commands/UpdateTranslationsCommand.php b/app/Console/Commands/UpdateTranslationsCommand.php index b8a06b76..c08b6513 100644 --- a/app/Console/Commands/UpdateTranslationsCommand.php +++ b/app/Console/Commands/UpdateTranslationsCommand.php @@ -76,8 +76,8 @@ protected function updateEverything(): void $values = collect($this->lines) ->map(fn (array $text, string $key) => [ 'group' => '*', - 'key' => $key, - 'text' => json_encode($text), + 'key' => $key, + 'text' => json_encode($text), ]) ->all(); @@ -101,8 +101,8 @@ protected function updateMissing(): void $newLines->push([ 'group' => '*', - 'key' => $key, - 'text' => json_encode($text), + 'key' => $key, + 'text' => json_encode($text), ]); } diff --git a/app/Exports/FormSubmissionsExport.php b/app/Exports/FormSubmissionsExport.php index 2e7be49e..b6d62aa8 100644 --- a/app/Exports/FormSubmissionsExport.php +++ b/app/Exports/FormSubmissionsExport.php @@ -33,7 +33,7 @@ public function styles(Worksheet $sheet) { return [ // Style the first row as bold text. - 1 => ['font' => ['bold' => true]], + 1 => ['font' => ['bold' => true]], ]; } diff --git a/app/Http/Controllers/Admin/AdminController.php b/app/Http/Controllers/Admin/AdminController.php index 6aaba9f5..384b2996 100644 --- a/app/Http/Controllers/Admin/AdminController.php +++ b/app/Http/Controllers/Admin/AdminController.php @@ -34,15 +34,15 @@ public function __construct() protected function resourceAbilityMap(): array { return [ - 'index' => 'viewAny', - 'show' => 'view', - 'create' => 'create', - 'store' => 'create', - 'duplicate' => 'update', - 'edit' => 'update', - 'update' => 'update', - 'destroy' => 'delete', - 'restore' => 'restore', + 'index' => 'viewAny', + 'show' => 'view', + 'create' => 'create', + 'store' => 'create', + 'duplicate' => 'update', + 'edit' => 'update', + 'update' => 'update', + 'destroy' => 'delete', + 'restore' => 'restore', 'forceDelete' => 'forceDelete', ]; } diff --git a/app/Http/Controllers/Admin/LanguageController.php b/app/Http/Controllers/Admin/LanguageController.php index e203f3cf..69ba0af4 100644 --- a/app/Http/Controllers/Admin/LanguageController.php +++ b/app/Http/Controllers/Admin/LanguageController.php @@ -57,7 +57,7 @@ public function edit(Language $language): Response { return Inertia::render('Languages/Edit', [ 'resource' => LanguageResource::make($language), - 'source' => LanguageLine::getTranslationsForGroup(config('app.fallback_locale'), '*'), + 'source' => LanguageLine::getTranslationsForGroup(config('app.fallback_locale'), '*'), ])->model(Language::class); } diff --git a/app/Http/Controllers/Admin/MenuController.php b/app/Http/Controllers/Admin/MenuController.php index 91afa232..ec5dc373 100644 --- a/app/Http/Controllers/Admin/MenuController.php +++ b/app/Http/Controllers/Admin/MenuController.php @@ -23,7 +23,7 @@ public function index(): RedirectResponse public function edit(string $location): Response { return Inertia::render('Menus/Edit', [ - 'location' => $location, + 'location' => $location, 'collection' => new MenuItemCollection( MenuItem::query() ->location($location) @@ -62,13 +62,13 @@ protected function prepareItems(array $items, string $location, int $depth = 0): return collect($items) ->map(function (array $item, int $index) use ($location, $depth) { $prepared = [ - 'location' => $location, - 'position' => $index + 1, - 'label' => $item['label'], - 'type' => $item['type'], - 'url' => $item['type'] === 'external' ? ($item['url'] ?? null) : null, - 'route' => $item['type'] === 'route' ? ($item['route'] ?? null) : null, - 'children' => $this->prepareItems($item['children'] ?? [], $location, ++$depth), + 'location' => $location, + 'position' => $index + 1, + 'label' => $item['label'], + 'type' => $item['type'], + 'url' => $item['type'] === 'external' ? ($item['url'] ?? null) : null, + 'route' => $item['type'] === 'route' ? ($item['route'] ?? null) : null, + 'children' => $this->prepareItems($item['children'] ?? [], $location, ++$depth), ]; if (MenuItem::allowedModels()->has($item['type'])) { diff --git a/app/Http/Controllers/Admin/PersonController.php b/app/Http/Controllers/Admin/PersonController.php index 5b38ffe1..512862fb 100644 --- a/app/Http/Controllers/Admin/PersonController.php +++ b/app/Http/Controllers/Admin/PersonController.php @@ -49,7 +49,7 @@ public function store(PersonRequest $request): RedirectResponse public function edit(Person $person): Response { return Inertia::render('People/Edit', [ - 'resource' => PersonResource::make($person), + 'resource' => PersonResource::make($person), 'platforms' => config('website-factory.social_platforms', []), ])->model(Person::class); } diff --git a/app/Http/Controllers/Admin/SettingController.php b/app/Http/Controllers/Admin/SettingController.php index 30ac78a7..450c496d 100644 --- a/app/Http/Controllers/Admin/SettingController.php +++ b/app/Http/Controllers/Admin/SettingController.php @@ -34,10 +34,10 @@ public function index(): RedirectResponse public function edit(string $section): Response { return Inertia::render('Settings/' . Str::studly($section), [ - 'section' => $section, + 'section' => $section, 'sections' => Setting::sections(), 'settings' => Setting::section($section), - 'data' => Setting::sectionData($section), + 'data' => Setting::sectionData($section), ])->model(Setting::class); } @@ -49,9 +49,9 @@ public function store(string $section, SettingRequest $request): RedirectRespons $settings = match ($section) { 'site' => $attributes->map( fn ($value, $key) => match ($key) { - default => $value, - 'logo' => $value?->storePubliclyAs('assets', 'logo.' . $value?->extension()), - 'favicon' => $value + default => $value, + 'logo' => $value?->storePubliclyAs('assets', 'logo.' . $value?->extension()), + 'favicon' => $value ?->manipulate(function (Image $image) { $image->fit(48, 48)->encode('png'); }) @@ -60,10 +60,10 @@ public function store(string $section, SettingRequest $request): RedirectRespons ), 'donations' => $attributes->map( fn ($value, $key) => match ($key) { - default => $value, - 'euplatesc_enabled' => \boolval($value), + default => $value, + 'euplatesc_enabled' => \boolval($value), - 'mobilpay_enabled' => \boolval($value), + 'mobilpay_enabled' => \boolval($value), 'mobilpay_certificate' => encrypt($value?->get()), 'mobilpay_private_key' => encrypt($value?->get()), } @@ -76,7 +76,7 @@ public function store(string $section, SettingRequest $request): RedirectRespons ->each( fn ($value, $key) => Setting::updateOrCreate( [ - 'key' => $key, + 'key' => $key, 'section' => $section, ], [ diff --git a/app/Http/Controllers/Front/DecisionAuthorController.php b/app/Http/Controllers/Front/DecisionAuthorController.php index dfbc4047..8a582588 100644 --- a/app/Http/Controllers/Front/DecisionAuthorController.php +++ b/app/Http/Controllers/Front/DecisionAuthorController.php @@ -23,7 +23,7 @@ public function show(string $locale, DecisionAuthor $decisionAuthor): View ->description($decisionAuthor->description); return view('front.decisions.category', [ - 'category' => $decisionAuthor, + 'category' => $decisionAuthor, 'decisions' => $decisionAuthor ->decisions() ->latest('published_at') diff --git a/app/Http/Controllers/Front/DecisionCategoryController.php b/app/Http/Controllers/Front/DecisionCategoryController.php index 106f75ae..b451d8e5 100644 --- a/app/Http/Controllers/Front/DecisionCategoryController.php +++ b/app/Http/Controllers/Front/DecisionCategoryController.php @@ -23,7 +23,7 @@ public function show(string $locale, DecisionCategory $decisionCategory): View ->description($decisionCategory->description); return view('front.decisions.category', [ - 'category' => $decisionCategory, + 'category' => $decisionCategory, 'decisions' => $decisionCategory ->decisions() ->latest('published_at') diff --git a/app/Http/Controllers/Front/DonationController.php b/app/Http/Controllers/Front/DonationController.php index f66a7414..3d3de41b 100644 --- a/app/Http/Controllers/Front/DonationController.php +++ b/app/Http/Controllers/Front/DonationController.php @@ -20,18 +20,18 @@ public function submit(string $locale, DonationRequest $request) abort_unless(PaymentGateway::isActive($attributes['gateway']), 403); $response = PaymentGateway::purchase($attributes['gateway'], [ - 'amount' => $attributes['amount'] ?? $attributes['other'], - 'currency' => $attributes['currency'], - 'transactionId' => (string) time(), + 'amount' => $attributes['amount'] ?? $attributes['other'], + 'currency' => $attributes['currency'], + 'transactionId' => (string) time(), 'transactionReference' => __('donation'), - 'returnUrl' => localized_route('front.donations.return'), - 'card' => [ + 'returnUrl' => localized_route('front.donations.return'), + 'card' => [ 'first_name' => $attributes['first_name'], - 'last_name' => $attributes['last_name'], - 'email' => $attributes['email'], - 'phone' => $attributes['phone'], + 'last_name' => $attributes['last_name'], + 'email' => $attributes['email'], + 'phone' => $attributes['phone'], ], - 'recurring' => (bool) $attributes['recurring'], + 'recurring' => (bool) $attributes['recurring'], ]); if ($response->isSuccessful()) { diff --git a/app/Http/Controllers/Front/PageController.php b/app/Http/Controllers/Front/PageController.php index 46a52dc1..9a6e93eb 100644 --- a/app/Http/Controllers/Front/PageController.php +++ b/app/Http/Controllers/Front/PageController.php @@ -29,7 +29,7 @@ public function index(): View ->image($image?->getUrl()); return view('front.pages.show', [ - 'page' => $page, + 'page' => $page, 'image' => $image, ]); } @@ -51,7 +51,7 @@ public function show(string $locale, Page $page): RedirectResponse|View $page->loadMissing('blocks.media'); return view('front.pages.show', [ - 'page' => $page, + 'page' => $page, 'image' => $image, ]); } diff --git a/app/Http/Controllers/Front/PersonController.php b/app/Http/Controllers/Front/PersonController.php index a2476ce5..9754e8c5 100644 --- a/app/Http/Controllers/Front/PersonController.php +++ b/app/Http/Controllers/Front/PersonController.php @@ -21,7 +21,7 @@ public function show(string $locale, Person $person): View return view('front.people.show', [ 'person' => $person, - 'image' => $image, + 'image' => $image, ]); } } diff --git a/app/Http/Controllers/Front/PostCategoryController.php b/app/Http/Controllers/Front/PostCategoryController.php index 234bb657..fbb71ad2 100644 --- a/app/Http/Controllers/Front/PostCategoryController.php +++ b/app/Http/Controllers/Front/PostCategoryController.php @@ -24,7 +24,7 @@ public function show(string $locale, PostCategory $postCategory): View return view('front.posts.category', [ 'category' => $postCategory, - 'posts' => $postCategory + 'posts' => $postCategory ->posts() ->with(['categories', 'media']) ->latest('published_at') diff --git a/app/Http/Controllers/Front/PostController.php b/app/Http/Controllers/Front/PostController.php index 52f0d21d..8b512f67 100644 --- a/app/Http/Controllers/Front/PostController.php +++ b/app/Http/Controllers/Front/PostController.php @@ -34,7 +34,7 @@ public function show(string $locale, Post $post): View ->image($image?->getUrl()); return view('front.posts.show', [ - 'post' => $post, + 'post' => $post, 'image' => $image, ]); } diff --git a/app/Http/Controllers/Front/SearchController.php b/app/Http/Controllers/Front/SearchController.php index 0368695f..6067897d 100644 --- a/app/Http/Controllers/Front/SearchController.php +++ b/app/Http/Controllers/Front/SearchController.php @@ -29,7 +29,7 @@ public function __invoke(SearchRequest $request) return response() ->view('front.search.results', [ 'query' => $attributes['query'], - 'type' => $attributes['type'], + 'type' => $attributes['type'], 'types' => $this->getAvailableTypes(), 'items' => $this->search($attributes['query'], $attributes['type']), ]) diff --git a/app/Http/Middleware/HandleInertiaRequests.php b/app/Http/Middleware/HandleInertiaRequests.php index 6631b762..e0c15181 100644 --- a/app/Http/Middleware/HandleInertiaRequests.php +++ b/app/Http/Middleware/HandleInertiaRequests.php @@ -31,19 +31,19 @@ class HandleInertiaRequests extends Middleware public function share(Request $request): array { return array_merge(parent::share($request), [ - 'auth' => fn () => $request->user(), + 'auth' => fn () => $request->user(), 'flash' => fn () => $this->flash($request), 'route' => fn () => $request->route()->getName(), - 'app' => fn () => [ - 'debug' => config('app.debug'), - 'version' => config('app.version'), - 'edition' => config('website-factory.edition'), + 'app' => fn () => [ + 'debug' => config('app.debug'), + 'version' => config('app.version'), + 'edition' => config('website-factory.edition'), 'features' => Features::all(), ], 'locales' => fn () => [ 'available' => locales(), - 'active' => active_locales()->keys(), - 'current' => active_locales()->has(app()->getLocale()) + 'active' => active_locales()->keys(), + 'current' => active_locales()->has(app()->getLocale()) ? app()->getLocale() : active_locales()->keys()->first(), ], @@ -67,7 +67,7 @@ protected function flash(Request $request): ?array return [ 'message' => $request->session()->get($type), 'details' => $request->session()->get('details'), - 'type' => $type, + 'type' => $type, ]; } @@ -173,10 +173,10 @@ protected function mediaLibraryConfig(): array return [ 'allowedExtensions' => $extractConfig('extensions'), - 'allowedMimeTypes' => $extractConfig('mime_types'), + 'allowedMimeTypes' => $extractConfig('mime_types'), 'maxFileSize' => [ - 'raw' => config('mediable.max_size'), + 'raw' => config('mediable.max_size'), 'formatted' => format_bytes(config('mediable.max_size')), ], ]; diff --git a/app/Http/Requests/Admin/DecisionAuthorRequest.php b/app/Http/Requests/Admin/DecisionAuthorRequest.php index 5ea6abe0..eeaf6dfd 100644 --- a/app/Http/Requests/Admin/DecisionAuthorRequest.php +++ b/app/Http/Requests/Admin/DecisionAuthorRequest.php @@ -18,9 +18,9 @@ class DecisionAuthorRequest extends BaseRequest public function rules(): array { return TranslatableFormRequestRules::make(DecisionAuthor::class, [ - 'title' => ['required', 'string', 'max:200'], - 'slug' => ['nullable', 'string', 'max:200'], - 'description' => ['nullable', 'string'], + 'title' => ['required', 'string', 'max:200'], + 'slug' => ['nullable', 'string', 'max:200'], + 'description' => ['nullable', 'string'], ]); } } diff --git a/app/Http/Requests/Admin/DecisionCategoryRequest.php b/app/Http/Requests/Admin/DecisionCategoryRequest.php index c7c482fd..61b3115d 100644 --- a/app/Http/Requests/Admin/DecisionCategoryRequest.php +++ b/app/Http/Requests/Admin/DecisionCategoryRequest.php @@ -18,9 +18,9 @@ class DecisionCategoryRequest extends BaseRequest public function rules(): array { return TranslatableFormRequestRules::make(DecisionCategory::class, [ - 'title' => ['required', 'string', 'max:200'], - 'slug' => ['nullable', 'string', 'max:200'], - 'description' => ['nullable', 'string'], + 'title' => ['required', 'string', 'max:200'], + 'slug' => ['nullable', 'string', 'max:200'], + 'description' => ['nullable', 'string'], ]); } } diff --git a/app/Http/Requests/Admin/DecisionRequest.php b/app/Http/Requests/Admin/DecisionRequest.php index e755a4f9..2721f81a 100644 --- a/app/Http/Requests/Admin/DecisionRequest.php +++ b/app/Http/Requests/Admin/DecisionRequest.php @@ -18,35 +18,35 @@ class DecisionRequest extends BaseRequest public function rules(): array { return TranslatableFormRequestRules::make(Decision::class, [ - 'title' => ['required', 'string', 'max:200'], - 'slug' => ['nullable', 'string', 'max:200'], - 'number' => ['nullable', 'string', 'max:200'], - 'date' => ['nullable', 'date'], - 'description' => ['nullable', 'string'], - 'published_at' => ['nullable', 'date'], - 'categories' => ['array'], - 'categories.*' => ['required', 'exists:decision_categories,id'], - 'authors' => ['array'], - 'authors.*' => ['required', 'exists:decision_authors,id'], - 'media' => ['array'], - 'media.*.id' => ['required', 'exists:media'], - 'blocks' => ['array'], - 'blocks.*.id' => ['required', 'numeric', 'integer'], - 'blocks.*.type' => ['required', 'string'], - 'blocks.*.content' => ['required', 'array'], - 'blocks.*.media' => ['array'], - 'blocks.*.media.*.id' => ['required', 'exists:media'], - 'blocks.*.related' => ['array'], - 'blocks.*.related.*.id' => ['required', 'numeric', 'integer'], - 'blocks.*.related.*.type' => ['required', 'string'], - 'blocks.*.children' => ['array'], - 'blocks.*.children.*.id' => ['required', 'numeric', 'integer'], - 'blocks.*.children.*.type' => ['required', 'string'], - 'blocks.*.children.*.content' => ['required', 'array'], - 'blocks.*.children.*.media' => ['array'], - 'blocks.*.children.*.media.*.id' => ['required', 'exists:media'], - 'blocks.*.children.*.related' => ['array'], - 'blocks.*.children.*.related.*.id' => ['required', 'numeric', 'integer'], + 'title' => ['required', 'string', 'max:200'], + 'slug' => ['nullable', 'string', 'max:200'], + 'number' => ['nullable', 'string', 'max:200'], + 'date' => ['nullable', 'date'], + 'description' => ['nullable', 'string'], + 'published_at' => ['nullable', 'date'], + 'categories' => ['array'], + 'categories.*' => ['required', 'exists:decision_categories,id'], + 'authors' => ['array'], + 'authors.*' => ['required', 'exists:decision_authors,id'], + 'media' => ['array'], + 'media.*.id' => ['required', 'exists:media'], + 'blocks' => ['array'], + 'blocks.*.id' => ['required', 'numeric', 'integer'], + 'blocks.*.type' => ['required', 'string'], + 'blocks.*.content' => ['required', 'array'], + 'blocks.*.media' => ['array'], + 'blocks.*.media.*.id' => ['required', 'exists:media'], + 'blocks.*.related' => ['array'], + 'blocks.*.related.*.id' => ['required', 'numeric', 'integer'], + 'blocks.*.related.*.type' => ['required', 'string'], + 'blocks.*.children' => ['array'], + 'blocks.*.children.*.id' => ['required', 'numeric', 'integer'], + 'blocks.*.children.*.type' => ['required', 'string'], + 'blocks.*.children.*.content' => ['required', 'array'], + 'blocks.*.children.*.media' => ['array'], + 'blocks.*.children.*.media.*.id' => ['required', 'exists:media'], + 'blocks.*.children.*.related' => ['array'], + 'blocks.*.children.*.related.*.id' => ['required', 'numeric', 'integer'], 'blocks.*.children.*.related.*.type' => ['required', 'string'], ]); } diff --git a/app/Http/Requests/Admin/FormRequest.php b/app/Http/Requests/Admin/FormRequest.php index c2b23e62..1235c250 100644 --- a/app/Http/Requests/Admin/FormRequest.php +++ b/app/Http/Requests/Admin/FormRequest.php @@ -20,17 +20,17 @@ class FormRequest extends BaseRequest public function rules(): array { return TranslatableFormRequestRules::make(Page::class, [ - 'title' => ['required', 'string', 'max:200'], - 'slug' => ['nullable', 'string', 'max:200'], - 'description' => ['nullable', 'string'], - 'published_at' => ['nullable', 'date'], + 'title' => ['required', 'string', 'max:200'], + 'slug' => ['nullable', 'string', 'max:200'], + 'description' => ['nullable', 'string'], + 'published_at' => ['nullable', 'date'], 'store_submissions' => ['nullable', 'boolean'], - 'send_submissions' => ['nullable', 'boolean'], - 'recipients' => [Rule::requiredIf($this->send_submissions), new OneEmailPerLine], - 'blocks' => ['array'], - 'blocks.*.id' => ['required', 'numeric', 'integer'], - 'blocks.*.type' => ['required', 'string'], - 'blocks.*.content' => ['required', 'array'], + 'send_submissions' => ['nullable', 'boolean'], + 'recipients' => [Rule::requiredIf($this->send_submissions), new OneEmailPerLine], + 'blocks' => ['array'], + 'blocks.*.id' => ['required', 'numeric', 'integer'], + 'blocks.*.type' => ['required', 'string'], + 'blocks.*.content' => ['required', 'array'], ]); } } diff --git a/app/Http/Requests/Admin/LanguageRequest.php b/app/Http/Requests/Admin/LanguageRequest.php index 08a5eedd..ef070105 100644 --- a/app/Http/Requests/Admin/LanguageRequest.php +++ b/app/Http/Requests/Admin/LanguageRequest.php @@ -17,13 +17,13 @@ class LanguageRequest extends BaseRequest public function rules(): array { return [ - 'code' => ['required', 'size:2', + 'code' => ['required', 'size:2', Rule::unique('languages', 'code')->ignore($this->code, 'code'), ], - 'name' => ['required', 'string'], + 'name' => ['required', 'string'], 'enabled' => ['boolean'], - 'lines' => ['array'], + 'lines' => ['array'], ]; } } diff --git a/app/Http/Requests/Admin/MenuRequest.php b/app/Http/Requests/Admin/MenuRequest.php index 4096c151..0e499c59 100644 --- a/app/Http/Requests/Admin/MenuRequest.php +++ b/app/Http/Requests/Admin/MenuRequest.php @@ -26,11 +26,11 @@ public function rules(): array protected function nestedRules(int $depth): array { $template = [ - '%prefix%' => ['array'], - '%prefix%.*.id' => ['nullable', 'integer'], + '%prefix%' => ['array'], + '%prefix%.*.id' => ['nullable', 'integer'], '%prefix%.*.label' => ['required', 'string'], - '%prefix%.*.type' => ['required', 'string'], - '%prefix%.*.url' => ['required_if:%prefix%.*.type,external', 'nullable', 'url'], + '%prefix%.*.type' => ['required', 'string'], + '%prefix%.*.url' => ['required_if:%prefix%.*.type,external', 'nullable', 'url'], '%prefix%.*.model' => ['required_if:%prefix%.*.type,' . MenuItem::allowedModels()->keys()->join(',')], '%prefix%.*.route' => ['required_if:%prefix%.*.type,route'], ]; diff --git a/app/Http/Requests/Admin/PageRequest.php b/app/Http/Requests/Admin/PageRequest.php index dad03be6..b00db0d3 100644 --- a/app/Http/Requests/Admin/PageRequest.php +++ b/app/Http/Requests/Admin/PageRequest.php @@ -18,30 +18,30 @@ class PageRequest extends BaseRequest public function rules(): array { return TranslatableFormRequestRules::make(Page::class, [ - 'title' => ['required', 'string', 'max:200'], - 'slug' => ['nullable', 'string', 'max:200'], - 'description' => ['nullable', 'string'], - 'published_at' => ['nullable', 'date'], - 'parent' => ['nullable', 'exists:pages,id'], - 'media' => ['array'], - 'media.*.id' => ['required', 'exists:media'], - 'blocks' => ['array'], - 'blocks.*.id' => ['required', 'numeric', 'integer'], - 'blocks.*.type' => ['required', 'string'], - 'blocks.*.content' => ['required', 'array'], - 'blocks.*.media' => ['array'], - 'blocks.*.media.*.id' => ['required', 'exists:media'], - 'blocks.*.related' => ['array'], - 'blocks.*.related.*.id' => ['required', 'numeric', 'integer'], - 'blocks.*.related.*.type' => ['required', 'string'], - 'blocks.*.children' => ['array'], - 'blocks.*.children.*.id' => ['required', 'numeric', 'integer'], - 'blocks.*.children.*.type' => ['required', 'string'], - 'blocks.*.children.*.content' => ['required', 'array'], - 'blocks.*.children.*.media' => ['array'], - 'blocks.*.children.*.media.*.id' => ['required', 'exists:media'], - 'blocks.*.children.*.related' => ['array'], - 'blocks.*.children.*.related.*.id' => ['required', 'numeric', 'integer'], + 'title' => ['required', 'string', 'max:200'], + 'slug' => ['nullable', 'string', 'max:200'], + 'description' => ['nullable', 'string'], + 'published_at' => ['nullable', 'date'], + 'parent' => ['nullable', 'exists:pages,id'], + 'media' => ['array'], + 'media.*.id' => ['required', 'exists:media'], + 'blocks' => ['array'], + 'blocks.*.id' => ['required', 'numeric', 'integer'], + 'blocks.*.type' => ['required', 'string'], + 'blocks.*.content' => ['required', 'array'], + 'blocks.*.media' => ['array'], + 'blocks.*.media.*.id' => ['required', 'exists:media'], + 'blocks.*.related' => ['array'], + 'blocks.*.related.*.id' => ['required', 'numeric', 'integer'], + 'blocks.*.related.*.type' => ['required', 'string'], + 'blocks.*.children' => ['array'], + 'blocks.*.children.*.id' => ['required', 'numeric', 'integer'], + 'blocks.*.children.*.type' => ['required', 'string'], + 'blocks.*.children.*.content' => ['required', 'array'], + 'blocks.*.children.*.media' => ['array'], + 'blocks.*.children.*.media.*.id' => ['required', 'exists:media'], + 'blocks.*.children.*.related' => ['array'], + 'blocks.*.children.*.related.*.id' => ['required', 'numeric', 'integer'], 'blocks.*.children.*.related.*.type' => ['required', 'string'], ]); } diff --git a/app/Http/Requests/Admin/PartnerRequest.php b/app/Http/Requests/Admin/PartnerRequest.php index 01f1c18d..1126a4b8 100644 --- a/app/Http/Requests/Admin/PartnerRequest.php +++ b/app/Http/Requests/Admin/PartnerRequest.php @@ -16,11 +16,11 @@ class PartnerRequest extends FormRequest public function rules() { return [ - 'name' => ['required', 'string', 'max:200'], - 'url' => ['nullable', 'string', 'url', 'max:200'], - 'position' => ['nullable', 'integer'], - 'media' => ['array'], - 'media.*.id' => ['required', 'exists:media'], + 'name' => ['required', 'string', 'max:200'], + 'url' => ['nullable', 'string', 'url', 'max:200'], + 'position' => ['nullable', 'integer'], + 'media' => ['array'], + 'media.*.id' => ['required', 'exists:media'], ]; } } diff --git a/app/Http/Requests/Admin/PersonRequest.php b/app/Http/Requests/Admin/PersonRequest.php index 916ec449..0f5d6ee9 100644 --- a/app/Http/Requests/Admin/PersonRequest.php +++ b/app/Http/Requests/Admin/PersonRequest.php @@ -23,21 +23,21 @@ public function rules(): array ->implode(','); return TranslatableFormRequestRules::make(Person::class, [ - 'name' => ['required', 'string', 'max:200'], - 'slug' => ['nullable', 'string', 'max:200', Rule::unique('people', 'slug')->ignore($this->person?->id), + 'name' => ['required', 'string', 'max:200'], + 'slug' => ['nullable', 'string', 'max:200', Rule::unique('people', 'slug')->ignore($this->person?->id), ], - 'title' => ['required', 'string', 'max:200'], - 'social' => ['nullable', "array:$platforms"], - 'social.*' => ['nullable', 'url'], - 'description' => ['nullable', 'string'], - 'media' => ['array'], - 'media.*.id' => ['required', 'exists:media'], - 'blocks' => ['array'], - 'blocks.*.id' => ['required', 'numeric', 'integer'], - 'blocks.*.type' => ['required', 'string'], - 'blocks.*.content' => ['required', 'array'], - 'blocks.*.children' => ['array'], - 'blocks.*.media' => ['array'], + 'title' => ['required', 'string', 'max:200'], + 'social' => ['nullable', "array:$platforms"], + 'social.*' => ['nullable', 'url'], + 'description' => ['nullable', 'string'], + 'media' => ['array'], + 'media.*.id' => ['required', 'exists:media'], + 'blocks' => ['array'], + 'blocks.*.id' => ['required', 'numeric', 'integer'], + 'blocks.*.type' => ['required', 'string'], + 'blocks.*.content' => ['required', 'array'], + 'blocks.*.children' => ['array'], + 'blocks.*.media' => ['array'], 'blocks.*.media.*.id' => ['required', 'exists:media'], ]); } diff --git a/app/Http/Requests/Admin/PostCategoryRequest.php b/app/Http/Requests/Admin/PostCategoryRequest.php index 41b08cae..137441d0 100644 --- a/app/Http/Requests/Admin/PostCategoryRequest.php +++ b/app/Http/Requests/Admin/PostCategoryRequest.php @@ -18,9 +18,9 @@ class PostCategoryRequest extends BaseRequest public function rules(): array { return TranslatableFormRequestRules::make(Post::class, [ - 'title' => ['required', 'string', 'max:200'], - 'slug' => ['nullable', 'string', 'max:200'], - 'description' => ['nullable', 'string'], + 'title' => ['required', 'string', 'max:200'], + 'slug' => ['nullable', 'string', 'max:200'], + 'description' => ['nullable', 'string'], ]); } } diff --git a/app/Http/Requests/Admin/PostRequest.php b/app/Http/Requests/Admin/PostRequest.php index 73df0996..f0907e96 100644 --- a/app/Http/Requests/Admin/PostRequest.php +++ b/app/Http/Requests/Admin/PostRequest.php @@ -18,21 +18,21 @@ class PostRequest extends BaseRequest public function rules(): array { return TranslatableFormRequestRules::make(Post::class, [ - 'title' => ['required', 'string', 'max:200'], - 'slug' => ['nullable', 'string', 'max:200'], - 'author' => ['nullable', 'string', 'max:200'], - 'description' => ['nullable', 'string'], - 'published_at' => ['nullable', 'date'], - 'categories' => ['array'], - 'categories.*' => ['required', 'exists:post_categories,id'], - 'media' => ['array'], - 'media.*.id' => ['required', 'exists:media'], - 'blocks' => ['array'], - 'blocks.*.id' => ['required', 'numeric', 'integer'], - 'blocks.*.type' => ['required', 'string'], - 'blocks.*.content' => ['required', 'array'], - 'blocks.*.children' => ['array'], - 'blocks.*.media' => ['array'], + 'title' => ['required', 'string', 'max:200'], + 'slug' => ['nullable', 'string', 'max:200'], + 'author' => ['nullable', 'string', 'max:200'], + 'description' => ['nullable', 'string'], + 'published_at' => ['nullable', 'date'], + 'categories' => ['array'], + 'categories.*' => ['required', 'exists:post_categories,id'], + 'media' => ['array'], + 'media.*.id' => ['required', 'exists:media'], + 'blocks' => ['array'], + 'blocks.*.id' => ['required', 'numeric', 'integer'], + 'blocks.*.type' => ['required', 'string'], + 'blocks.*.content' => ['required', 'array'], + 'blocks.*.children' => ['array'], + 'blocks.*.media' => ['array'], 'blocks.*.media.*.id' => ['required', 'exists:media'], ]); } diff --git a/app/Http/Requests/Admin/SettingRequest.php b/app/Http/Requests/Admin/SettingRequest.php index a8db228c..e7e05e59 100644 --- a/app/Http/Requests/Admin/SettingRequest.php +++ b/app/Http/Requests/Admin/SettingRequest.php @@ -30,17 +30,17 @@ public function rules(): array { if ($this->section === 'site') { $rules = [ - 'settings.title' => ['array'], - 'settings.description' => ['array'], - 'settings.logo' => ['nullable', 'image', 'mimes:jpg,png,gif,svg'], - 'settings.favicon' => ['nullable', 'image', 'mimes:jpg,png,gif', 'dimensions:min_width=32,max_width=1000'], + 'settings.title' => ['array'], + 'settings.description' => ['array'], + 'settings.logo' => ['nullable', 'image', 'mimes:jpg,png,gif,svg'], + 'settings.favicon' => ['nullable', 'image', 'mimes:jpg,png,gif', 'dimensions:min_width=32,max_width=1000'], 'settings.default_locale' => ['required', 'exists:languages,code'], - 'settings.front_page' => ['required', 'exists:pages,id'], - 'settings.privacy_page' => ['required', 'exists:pages,id'], - 'settings.terms_page' => ['required', 'exists:pages,id'], - 'settings.html' => ['array'], - 'settings.html.header' => ['nullable', 'string'], - 'settings.html.footer' => ['nullable', 'string'], + 'settings.front_page' => ['required', 'exists:pages,id'], + 'settings.privacy_page' => ['required', 'exists:pages,id'], + 'settings.terms_page' => ['required', 'exists:pages,id'], + 'settings.html' => ['array'], + 'settings.html.header' => ['nullable', 'string'], + 'settings.html.footer' => ['nullable', 'string'], ]; if (Features::hasTheme()) { @@ -54,8 +54,8 @@ public function rules(): array if ($this->section === 'site-notice') { return [ 'settings.enabled' => ['required', 'boolean'], - 'settings.color' => ['required', new ValidHex], - 'settings.text' => ['array'], + 'settings.color' => ['required', new ValidHex], + 'settings.text' => ['array'], ]; } @@ -72,18 +72,18 @@ public function rules(): array if ($this->section === 'donations') { return [ - 'settings.page.thanks' => ['required', 'exists:pages,id'], - 'settings.amounts' => ['array'], + 'settings.page.thanks' => ['required', 'exists:pages,id'], + 'settings.amounts' => ['array'], 'settings.amounts.*.amount' => ['required', 'integer'], - 'settings.mobilpay_enabled' => ['boolean'], - 'settings.mobilpay_signature' => ['nullable', 'regex:/^([A-Z0-9]{4}-?){5}$/'], + 'settings.mobilpay_enabled' => ['boolean'], + 'settings.mobilpay_signature' => ['nullable', 'regex:/^([A-Z0-9]{4}-?){5}$/'], 'settings.mobilpay_certificate' => ['nullable', 'file'], 'settings.mobilpay_private_key' => ['nullable', 'file'], 'settings.euplatesc_enabled' => ['boolean'], - 'settings.euplatesc_mid' => ['nullable', 'string'], - 'settings.euplatesc_key' => ['nullable', 'string'], + 'settings.euplatesc_mid' => ['nullable', 'string'], + 'settings.euplatesc_key' => ['nullable', 'string'], ]; } diff --git a/app/Http/Requests/Admin/UserRequest.php b/app/Http/Requests/Admin/UserRequest.php index eff99890..a3f45170 100644 --- a/app/Http/Requests/Admin/UserRequest.php +++ b/app/Http/Requests/Admin/UserRequest.php @@ -19,9 +19,9 @@ class UserRequest extends BaseRequest public function rules(): array { return [ - 'name' => ['required', 'string', 'max:200'], - 'email' => ['required', 'email', Rule::unique('users')->ignore($this->user)], - 'role' => ['required', 'string', new Enum(UserRole::class)], + 'name' => ['required', 'string', 'max:200'], + 'email' => ['required', 'email', Rule::unique('users')->ignore($this->user)], + 'role' => ['required', 'string', new Enum(UserRole::class)], 'locale' => ['required', 'string', Rule::in(locales()->keys())], ]; } diff --git a/app/Http/Requests/Front/DonationRequest.php b/app/Http/Requests/Front/DonationRequest.php index a599b627..c5d88235 100644 --- a/app/Http/Requests/Front/DonationRequest.php +++ b/app/Http/Requests/Front/DonationRequest.php @@ -17,15 +17,15 @@ class DonationRequest extends FormRequest public function rules() { return [ - 'gateway' => ['required', Rule::in(array_keys(settings('payments.gateways') ?? []))], - 'amount' => ['exclude_if:amount,other', 'integer'], - 'other' => ['required_if:amount,other', 'integer'], - 'currency' => ['required', 'in:RON,EUR'], + 'gateway' => ['required', Rule::in(array_keys(settings('payments.gateways') ?? []))], + 'amount' => ['exclude_if:amount,other', 'integer'], + 'other' => ['required_if:amount,other', 'integer'], + 'currency' => ['required', 'in:RON,EUR'], 'first_name' => ['required', 'string', 'max:100'], - 'last_name' => ['required', 'string', 'max:100'], - 'email' => ['required', 'email'], - 'phone' => ['nullable', 'string'], - 'recurring' => ['boolean'], + 'last_name' => ['required', 'string', 'max:100'], + 'email' => ['required', 'email'], + 'phone' => ['nullable', 'string'], + 'recurring' => ['boolean'], ]; } } diff --git a/app/Http/Requests/Front/FormSubmissionRequest.php b/app/Http/Requests/Front/FormSubmissionRequest.php index f47ba4f5..f9f62058 100644 --- a/app/Http/Requests/Front/FormSubmissionRequest.php +++ b/app/Http/Requests/Front/FormSubmissionRequest.php @@ -27,16 +27,16 @@ public function rules(): array return [ "field-{$field->id}" => match ($field->type) { 'checkbox' => $this->rulesOptions($field, $rules), - 'date' => $this->rulesDate($field, $rules), - 'email' => $this->rulesEmail($field, $rules), - 'file' => $this->rulesFile($field, $rules), - 'number' => $this->rulesNumber($field, $rules), - 'radio' => $this->rulesOption($field, $rules), - 'select' => $this->rulesOption($field, $rules), - 'text' => $this->rulesText($field, $rules), + 'date' => $this->rulesDate($field, $rules), + 'email' => $this->rulesEmail($field, $rules), + 'file' => $this->rulesFile($field, $rules), + 'number' => $this->rulesNumber($field, $rules), + 'radio' => $this->rulesOption($field, $rules), + 'select' => $this->rulesOption($field, $rules), + 'text' => $this->rulesText($field, $rules), 'textarea' => $this->rulesText($field, $rules), - 'url' => $this->rulesUrl($field, $rules), - default => throw new InvalidFormFieldTypeException($field->type), + 'url' => $this->rulesUrl($field, $rules), + default => throw new InvalidFormFieldTypeException($field->type), }, ]; }) diff --git a/app/Http/Requests/Front/SearchRequest.php b/app/Http/Requests/Front/SearchRequest.php index a9f3723f..017a50dc 100644 --- a/app/Http/Requests/Front/SearchRequest.php +++ b/app/Http/Requests/Front/SearchRequest.php @@ -18,7 +18,7 @@ public function rules() { return [ 'query' => ['required', 'string', 'min:3'], - 'type' => ['string', Rule::in( + 'type' => ['string', Rule::in( collect(config('search.models')) ->map(fn (string $model) => app($model)->getMorphClass()) )], diff --git a/app/Http/Resources/BlockResource.php b/app/Http/Resources/BlockResource.php index f77e4489..ae4e8eaf 100644 --- a/app/Http/Resources/BlockResource.php +++ b/app/Http/Resources/BlockResource.php @@ -17,14 +17,14 @@ protected function default(Request $request): array $this->withoutPermissions(); return [ - 'id' => $this->id, - 'type' => $this->type, - 'content' => $this->content, + 'id' => $this->id, + 'type' => $this->type, + 'content' => $this->content, 'children' => self::collection($this->children), - 'media' => MediaResource::collection( + 'media' => MediaResource::collection( $this->media()->whereIsOriginal()->get() ), - 'related' => RelatedResource::collection( + 'related' => RelatedResource::collection( $this->related_items, ), ]; diff --git a/app/Http/Resources/Collections/ResourceCollection.php b/app/Http/Resources/Collections/ResourceCollection.php index c8332ef3..3019ff61 100644 --- a/app/Http/Resources/Collections/ResourceCollection.php +++ b/app/Http/Resources/Collections/ResourceCollection.php @@ -71,14 +71,14 @@ public function toArray($request): array $morphClass = $this->model->getMorphClass(); return array_merge([ - 'columns' => $this->tableColumns($request), - 'statuses' => $this->statuses(), - 'filters' => $this->filters($request), - 'sort' => $this->sort($request), - 'data' => $this->collection, + 'columns' => $this->tableColumns($request), + 'statuses' => $this->statuses(), + 'filters' => $this->filters($request), + 'sort' => $this->sort($request), + 'data' => $this->collection, 'properties' => [ - 'model' => $morphClass, - 'main_action_route' => $this->mainActionRoute ?? 'admin.' . Str::plural($morphClass) . '.edit', + 'model' => $morphClass, + 'main_action_route' => $this->mainActionRoute ?? 'admin.' . Str::plural($morphClass) . '.edit', 'admin_route_prefix' => 'admin.' . Str::plural($morphClass), 'front_route_prefix' => 'front.' . Str::plural($morphClass), ], @@ -95,8 +95,8 @@ protected function tableColumns(Request $request): Collection { return $this->getColumnsByRouteName($request) ->map(fn (string $column) => [ - 'field' => Str::replace('.', '___', $column), - 'label' => __("field.{$column}"), + 'field' => Str::replace('.', '___', $column), + 'label' => __("field.{$column}"), 'sortable' => $this->isColumnSortable($column), ]); } @@ -158,7 +158,7 @@ protected function sort(Request $request): ?array if (! \is_string($column)) { return [ - 'column' => null, + 'column' => null, 'direction' => null, ]; } @@ -170,13 +170,13 @@ protected function sort(Request $request): ?array if (! $this->isColumnSortable($column)) { return [ - 'column' => null, + 'column' => null, 'direction' => null, ]; } return [ - 'column' => $column, + 'column' => $column, 'direction' => $direction, ]; } @@ -187,7 +187,7 @@ protected function statuses(): array if (SupportsTrait::publishable($this->model)) { $statuses->push([ - 'name' => 'all', + 'name' => 'all', 'count' => $this->model ->newQuery() ->withDrafted() @@ -195,14 +195,14 @@ protected function statuses(): array ]); $statuses->push([ - 'name' => 'published', + 'name' => 'published', 'count' => $this->model ->newQuery() ->count(), ]); $statuses->push([ - 'name' => 'draft', + 'name' => 'draft', 'count' => $this->model ->newQuery() ->onlyDrafted() @@ -210,7 +210,7 @@ protected function statuses(): array ]); } else { $statuses->push([ - 'name' => 'all', + 'name' => 'all', 'count' => $this->model ->newQuery() ->count(), @@ -219,7 +219,7 @@ protected function statuses(): array if (SupportsTrait::softDeletes($this->model)) { $statuses->push([ - 'name' => 'trashed', + 'name' => 'trashed', 'count' => $this->model ->newQuery() ->onlyTrashed() diff --git a/app/Http/Resources/DecisionAuthorResource.php b/app/Http/Resources/DecisionAuthorResource.php index 9fcce084..77a418ba 100644 --- a/app/Http/Resources/DecisionAuthorResource.php +++ b/app/Http/Resources/DecisionAuthorResource.php @@ -10,27 +10,27 @@ class DecisionAuthorResource extends Resource { public array $routeMap = [ 'admin.decision_authors.index' => 'index', - 'admin.decision_authors.edit' => 'edit', + 'admin.decision_authors.edit' => 'edit', ]; protected function index(Request $request): array { return [ - 'id' => $this->id, - 'title' => $this->title, - 'slug' => $this->slug, + 'id' => $this->id, + 'title' => $this->title, + 'slug' => $this->slug, 'decisions_count' => $this->decisions_count, - 'trashed' => $this->trashed(), + 'trashed' => $this->trashed(), ]; } protected function edit(Request $request): array { return [ - 'id' => $this->id, - 'title' => $this->getTranslations('title'), - 'description' => $this->getTranslations('description'), - 'slug' => $this->getTranslations('slug'), + 'id' => $this->id, + 'title' => $this->getTranslations('title'), + 'description' => $this->getTranslations('description'), + 'slug' => $this->getTranslations('slug'), ]; } @@ -39,7 +39,7 @@ protected function default(Request $request): array $this->withoutPermissions(); return [ - 'id' => $this->id, + 'id' => $this->id, 'title' => $this->title, ]; } diff --git a/app/Http/Resources/DecisionCategoryResource.php b/app/Http/Resources/DecisionCategoryResource.php index 60781015..137f896f 100644 --- a/app/Http/Resources/DecisionCategoryResource.php +++ b/app/Http/Resources/DecisionCategoryResource.php @@ -10,27 +10,27 @@ class DecisionCategoryResource extends Resource { public array $routeMap = [ 'admin.decision_categories.index' => 'index', - 'admin.decision_categories.edit' => 'edit', + 'admin.decision_categories.edit' => 'edit', ]; protected function index(Request $request): array { return [ - 'id' => $this->id, - 'title' => $this->title, - 'slug' => $this->slug, + 'id' => $this->id, + 'title' => $this->title, + 'slug' => $this->slug, 'decisions_count' => $this->decisions_count, - 'trashed' => $this->trashed(), + 'trashed' => $this->trashed(), ]; } protected function edit(Request $request): array { return [ - 'id' => $this->id, - 'title' => $this->getTranslations('title'), - 'description' => $this->getTranslations('description'), - 'slug' => $this->getTranslations('slug'), + 'id' => $this->id, + 'title' => $this->getTranslations('title'), + 'description' => $this->getTranslations('description'), + 'slug' => $this->getTranslations('slug'), ]; } @@ -39,7 +39,7 @@ protected function default(Request $request): array $this->withoutPermissions(); return [ - 'id' => $this->id, + 'id' => $this->id, 'title' => $this->title, ]; } diff --git a/app/Http/Resources/DecisionResource.php b/app/Http/Resources/DecisionResource.php index f8177bcd..3ec57571 100644 --- a/app/Http/Resources/DecisionResource.php +++ b/app/Http/Resources/DecisionResource.php @@ -9,42 +9,42 @@ class DecisionResource extends Resource { public array $routeMap = [ - 'admin.decisions.index' => 'index', - 'admin.decisions.edit' => 'edit', + 'admin.decisions.index' => 'index', + 'admin.decisions.edit' => 'edit', ]; protected function index(Request $request): array { return [ - 'id' => $this->id, - 'title' => $this->title, - 'slug' => $this->slug, - 'number' => $this->number, - 'date' => $this->date?->toDateString(), - 'created_at' => $this->created_at->toDateTimeString(), + 'id' => $this->id, + 'title' => $this->title, + 'slug' => $this->slug, + 'number' => $this->number, + 'date' => $this->date?->toDateString(), + 'created_at' => $this->created_at->toDateTimeString(), 'published_at' => $this->published_at?->toDateTimeString(), - 'categories' => $this->categories, - 'authors' => $this->authors, - 'trashed' => $this->trashed(), - 'status' => $this->status(), + 'categories' => $this->categories, + 'authors' => $this->authors, + 'trashed' => $this->trashed(), + 'status' => $this->status(), ]; } protected function edit(Request $request): array { return [ - 'id' => $this->id, - 'title' => $this->getTranslations('title'), - 'description' => $this->getTranslations('description'), - 'slug' => $this->getTranslations('slug'), - 'created_at' => $this->created_at->toDateTimeString(), + 'id' => $this->id, + 'title' => $this->getTranslations('title'), + 'description' => $this->getTranslations('description'), + 'slug' => $this->getTranslations('slug'), + 'created_at' => $this->created_at->toDateTimeString(), 'published_at' => $this->published_at?->toDateTimeString(), - 'categories' => $this->categories->pluck('id'), - 'authors' => $this->authors->pluck('id'), - 'number' => $this->number, - 'date' => $this->date, - 'blocks' => BlockResource::collection($this->blocks), - 'media' => MediaResource::collection( + 'categories' => $this->categories->pluck('id'), + 'authors' => $this->authors->pluck('id'), + 'number' => $this->number, + 'date' => $this->date, + 'blocks' => BlockResource::collection($this->blocks), + 'media' => MediaResource::collection( $this->media()->whereIsOriginal()->get() ), ]; @@ -53,8 +53,8 @@ protected function edit(Request $request): array protected function default(Request $request): array { return [ - 'id' => $this->id, - 'title' => $this->title, + 'id' => $this->id, + 'title' => $this->title, ]; } } diff --git a/app/Http/Resources/FormResource.php b/app/Http/Resources/FormResource.php index 9feb41f8..6f57be1a 100644 --- a/app/Http/Resources/FormResource.php +++ b/app/Http/Resources/FormResource.php @@ -9,21 +9,21 @@ class FormResource extends Resource { public array $routeMap = [ - 'admin.forms.index' => 'index', - 'admin.forms.show' => 'show', - 'admin.forms.edit' => 'edit', + 'admin.forms.index' => 'index', + 'admin.forms.show' => 'show', + 'admin.forms.edit' => 'edit', ]; protected function index(Request $request): array { return [ - 'id' => $this->id, - 'title' => $this->title, - 'slug' => $this->slug, - 'created_at' => $this->created_at->toDateTimeString(), - 'trashed' => $this->trashed(), + 'id' => $this->id, + 'title' => $this->title, + 'slug' => $this->slug, + 'created_at' => $this->created_at->toDateTimeString(), + 'trashed' => $this->trashed(), 'store_submissions' => $this->store_submissions, - 'send_submissions' => $this->send_submissions, + 'send_submissions' => $this->send_submissions, 'submissions_count' => $this->submissions_count, ]; } @@ -31,33 +31,33 @@ protected function index(Request $request): array protected function show(Request $request): array { return [ - 'id' => $this->id, - 'title' => $this->title, - 'description' => $this->description, - 'slug' => $this->slug, - 'created_at' => $this->created_at->toDateTimeString(), + 'id' => $this->id, + 'title' => $this->title, + 'description' => $this->description, + 'slug' => $this->slug, + 'created_at' => $this->created_at->toDateTimeString(), // 'published_at' => $this->published_at?->toDateTimeString(), 'store_submissions' => $this->store_submissions, - 'send_submissions' => $this->send_submissions, - 'recipients' => $this->recipients, - 'blocks' => BlockResource::collection($this->blocks), - 'submissions' => FormSubmissionResource::collection($this->submissions), + 'send_submissions' => $this->send_submissions, + 'recipients' => $this->recipients, + 'blocks' => BlockResource::collection($this->blocks), + 'submissions' => FormSubmissionResource::collection($this->submissions), ]; } protected function edit(Request $request): array { return [ - 'id' => $this->id, - 'title' => $this->getTranslations('title'), - 'description' => $this->getTranslations('description'), - 'slug' => $this->getTranslations('slug'), - 'created_at' => $this->created_at->toDateTimeString(), + 'id' => $this->id, + 'title' => $this->getTranslations('title'), + 'description' => $this->getTranslations('description'), + 'slug' => $this->getTranslations('slug'), + 'created_at' => $this->created_at->toDateTimeString(), // 'published_at' => $this->published_at?->toDateTimeString(), 'store_submissions' => $this->store_submissions, - 'send_submissions' => $this->send_submissions, - 'recipients' => $this->recipients, - 'blocks' => BlockResource::collection($this->blocks), + 'send_submissions' => $this->send_submissions, + 'recipients' => $this->recipients, + 'blocks' => BlockResource::collection($this->blocks), ]; } @@ -66,8 +66,8 @@ protected function default(Request $request): array $this->withoutPermissions(); return [ - 'id' => $this->id, - 'type' => $this->getMorphClass(), + 'id' => $this->id, + 'type' => $this->getMorphClass(), 'title' => $this->title, ]; } diff --git a/app/Http/Resources/FormSubmissionResource.php b/app/Http/Resources/FormSubmissionResource.php index 9bea111d..acafa48f 100644 --- a/app/Http/Resources/FormSubmissionResource.php +++ b/app/Http/Resources/FormSubmissionResource.php @@ -15,20 +15,20 @@ class FormSubmissionResource extends Resource protected function show(Request $request): array { return [ - 'id' => $this->id, - 'form' => FormResource::make($this->form), - 'created_at' => $this->created_at->toDateTimeString(), - 'uuid' => $this->uuid, - 'data' => $this->data, + 'id' => $this->id, + 'form' => FormResource::make($this->form), + 'created_at' => $this->created_at->toDateTimeString(), + 'uuid' => $this->uuid, + 'data' => $this->data, ]; } protected function default(Request $request): array { return [ - 'id' => $this->id, - 'form' => $this->form_id, - 'created_at' => $this->created_at->toDateTimeString(), + 'id' => $this->id, + 'form' => $this->form_id, + 'created_at' => $this->created_at->toDateTimeString(), ]; } } diff --git a/app/Http/Resources/LanguageResource.php b/app/Http/Resources/LanguageResource.php index 4b896526..7a0049e6 100644 --- a/app/Http/Resources/LanguageResource.php +++ b/app/Http/Resources/LanguageResource.php @@ -12,11 +12,11 @@ class LanguageResource extends Resource protected function default(Request $request): array { return [ - 'id' => $this->code, - 'code' => $this->code, - 'name' => $this->name, + 'id' => $this->code, + 'code' => $this->code, + 'name' => $this->name, 'enabled' => $this->enabled, - 'lines' => LanguageLine::getTranslationsForGroup($this->code, '*'), + 'lines' => LanguageLine::getTranslationsForGroup($this->code, '*'), ]; } } diff --git a/app/Http/Resources/MediaResource.php b/app/Http/Resources/MediaResource.php index 05b802fc..a30bb109 100644 --- a/app/Http/Resources/MediaResource.php +++ b/app/Http/Resources/MediaResource.php @@ -15,16 +15,16 @@ class MediaResource extends Resource protected function default(Request $request): array { $resource = [ - 'id' => $this->id, - 'directory' => $this->directory, - 'filename' => $this->filename, - 'extension' => $this->extension, - 'mime_type' => $this->mime_type, + 'id' => $this->id, + 'directory' => $this->directory, + 'filename' => $this->filename, + 'extension' => $this->extension, + 'mime_type' => $this->mime_type, 'aggregate_type' => $this->aggregate_type, - 'size' => $this->readableSize(), - 'caption' => $this->getTranslationsWithFallback('caption'), - 'created_at' => $this->created_at->toDateTimeString(), - 'updated_at' => $this->updated_at->toDateTimeString(), + 'size' => $this->readableSize(), + 'caption' => $this->getTranslationsWithFallback('caption'), + 'created_at' => $this->created_at->toDateTimeString(), + 'updated_at' => $this->updated_at->toDateTimeString(), ]; if ($this->wasRecentlyCreated) { diff --git a/app/Http/Resources/MenuItemResource.php b/app/Http/Resources/MenuItemResource.php index 630d7a2b..f223e749 100644 --- a/app/Http/Resources/MenuItemResource.php +++ b/app/Http/Resources/MenuItemResource.php @@ -13,14 +13,14 @@ protected function default(Request $request): array $this->withoutPermissions(); return [ - 'id' => $this->id, - 'type' => $this->normalized_type, - 'label' => $this->getTranslationsWithFallback('label'), - 'url' => $this->getTranslationsWithFallback('url'), - 'model_type' => $this->model_type, - 'model' => $this->model_id, - 'route' => $this->route, - 'children' => self::collection($this->children), + 'id' => $this->id, + 'type' => $this->normalized_type, + 'label' => $this->getTranslationsWithFallback('label'), + 'url' => $this->getTranslationsWithFallback('url'), + 'model_type' => $this->model_type, + 'model' => $this->model_id, + 'route' => $this->route, + 'children' => self::collection($this->children), ]; } } diff --git a/app/Http/Resources/PageResource.php b/app/Http/Resources/PageResource.php index 9620a29d..5f625ba8 100644 --- a/app/Http/Resources/PageResource.php +++ b/app/Http/Resources/PageResource.php @@ -9,35 +9,35 @@ class PageResource extends Resource { public array $routeMap = [ - 'admin.pages.index' => 'index', - 'admin.pages.edit' => 'edit', + 'admin.pages.index' => 'index', + 'admin.pages.edit' => 'edit', ]; protected function index(Request $request): array { return [ - 'id' => $this->id, - 'title' => $this->title, - 'slug' => $this->slug, - 'created_at' => $this->created_at->toDateTimeString(), + 'id' => $this->id, + 'title' => $this->title, + 'slug' => $this->slug, + 'created_at' => $this->created_at->toDateTimeString(), 'published_at' => $this->published_at?->toDateTimeString(), - 'trashed' => $this->trashed(), - 'status' => $this->status(), + 'trashed' => $this->trashed(), + 'status' => $this->status(), ]; } protected function edit(Request $request): array { return [ - 'id' => $this->id, - 'title' => $this->getTranslations('title'), - 'description' => $this->getTranslations('description'), - 'slug' => $this->getTranslations('slug'), - 'created_at' => $this->created_at->toDateTimeString(), + 'id' => $this->id, + 'title' => $this->getTranslations('title'), + 'description' => $this->getTranslations('description'), + 'slug' => $this->getTranslations('slug'), + 'created_at' => $this->created_at->toDateTimeString(), 'published_at' => $this->published_at?->toDateTimeString(), - 'parent' => $this->parent_id, - 'blocks' => BlockResource::collection($this->blocks), - 'media' => MediaResource::collection( + 'parent' => $this->parent_id, + 'blocks' => BlockResource::collection($this->blocks), + 'media' => MediaResource::collection( $this->media()->whereIsOriginal()->get() ), ]; @@ -48,7 +48,7 @@ protected function default(Request $request): array $this->withoutPermissions(); return [ - 'id' => $this->id, + 'id' => $this->id, 'title' => $this->title, ]; } diff --git a/app/Http/Resources/PartnerResource.php b/app/Http/Resources/PartnerResource.php index da9e37f2..97ceff43 100644 --- a/app/Http/Resources/PartnerResource.php +++ b/app/Http/Resources/PartnerResource.php @@ -9,32 +9,32 @@ class PartnerResource extends Resource { public array $routeMap = [ - 'admin.partners.index' => 'index', - 'admin.partners.edit' => 'edit', + 'admin.partners.index' => 'index', + 'admin.partners.edit' => 'edit', ]; protected function index(Request $request): array { return [ - 'id' => $this->id, - 'name' => $this->name, - 'url' => $this->url, - 'position' => $this->position, - 'created_at' => $this->created_at->toDateTimeString(), - 'trashed' => $this->trashed(), + 'id' => $this->id, + 'name' => $this->name, + 'url' => $this->url, + 'position' => $this->position, + 'created_at' => $this->created_at->toDateTimeString(), + 'trashed' => $this->trashed(), ]; } protected function edit(Request $request): array { return [ - 'id' => $this->id, - 'name' => $this->name, - 'url' => $this->url, - 'position' => $this->position, - 'created_at' => $this->created_at->toDateTimeString(), + 'id' => $this->id, + 'name' => $this->name, + 'url' => $this->url, + 'position' => $this->position, + 'created_at' => $this->created_at->toDateTimeString(), 'published_at' => $this->published_at?->toDateTimeString(), - 'media' => MediaResource::collection( + 'media' => MediaResource::collection( $this->media()->whereIsOriginal()->get() ), ]; @@ -45,9 +45,9 @@ protected function default(Request $request): array $this->withoutPermissions(); return [ - 'id' => $this->id, - 'name' => $this->name, - 'url' => $this->url, + 'id' => $this->id, + 'name' => $this->name, + 'url' => $this->url, 'position' => $this->position, ]; } diff --git a/app/Http/Resources/PersonResource.php b/app/Http/Resources/PersonResource.php index 27148cd1..1c7dea64 100644 --- a/app/Http/Resources/PersonResource.php +++ b/app/Http/Resources/PersonResource.php @@ -9,34 +9,34 @@ class PersonResource extends Resource { public array $routeMap = [ - 'admin.people.index' => 'index', - 'admin.people.edit' => 'edit', + 'admin.people.index' => 'index', + 'admin.people.edit' => 'edit', ]; protected function index(Request $request): array { return [ - 'id' => $this->id, - 'name' => $this->name, - 'title' => $this->title, - 'slug' => $this->slug, + 'id' => $this->id, + 'name' => $this->name, + 'title' => $this->title, + 'slug' => $this->slug, 'created_at' => $this->created_at->toDateTimeString(), - 'trashed' => $this->trashed(), + 'trashed' => $this->trashed(), ]; } protected function edit(Request $request): array { return [ - 'id' => $this->id, - 'name' => $this->name, - 'slug' => $this->slug, - 'title' => $this->getTranslations('title'), - 'social' => $this->getSocialProfiles(), - 'description' => $this->getTranslations('description'), - 'created_at' => $this->created_at->toDateTimeString(), - 'blocks' => BlockResource::collection($this->blocks), - 'media' => MediaResource::collection( + 'id' => $this->id, + 'name' => $this->name, + 'slug' => $this->slug, + 'title' => $this->getTranslations('title'), + 'social' => $this->getSocialProfiles(), + 'description' => $this->getTranslations('description'), + 'created_at' => $this->created_at->toDateTimeString(), + 'blocks' => BlockResource::collection($this->blocks), + 'media' => MediaResource::collection( $this->media()->whereIsOriginal()->get() ), ]; @@ -47,8 +47,8 @@ protected function default(Request $request): array $this->withoutPermissions(); return [ - 'id' => $this->id, - 'type' => $this->getMorphClass(), + 'id' => $this->id, + 'type' => $this->getMorphClass(), 'title' => $this->name, ]; } diff --git a/app/Http/Resources/PostCategoryResource.php b/app/Http/Resources/PostCategoryResource.php index 12043d96..d6fa54a4 100644 --- a/app/Http/Resources/PostCategoryResource.php +++ b/app/Http/Resources/PostCategoryResource.php @@ -10,27 +10,27 @@ class PostCategoryResource extends Resource { public array $routeMap = [ 'admin.post_categories.index' => 'index', - 'admin.post_categories.edit' => 'edit', + 'admin.post_categories.edit' => 'edit', ]; protected function index(Request $request): array { return [ - 'id' => $this->id, - 'title' => $this->title, - 'slug' => $this->slug, + 'id' => $this->id, + 'title' => $this->title, + 'slug' => $this->slug, 'posts_count' => $this->posts_count, - 'trashed' => $this->trashed(), + 'trashed' => $this->trashed(), ]; } protected function edit(Request $request): array { return [ - 'id' => $this->id, - 'title' => $this->getTranslations('title'), - 'description' => $this->getTranslations('description'), - 'slug' => $this->getTranslations('slug'), + 'id' => $this->id, + 'title' => $this->getTranslations('title'), + 'description' => $this->getTranslations('description'), + 'slug' => $this->getTranslations('slug'), ]; } @@ -39,7 +39,7 @@ protected function default(Request $request): array $this->withoutPermissions(); return [ - 'id' => $this->id, + 'id' => $this->id, 'title' => $this->title, ]; } diff --git a/app/Http/Resources/PostResource.php b/app/Http/Resources/PostResource.php index a242c1cd..3533b62a 100644 --- a/app/Http/Resources/PostResource.php +++ b/app/Http/Resources/PostResource.php @@ -9,37 +9,37 @@ class PostResource extends Resource { public array $routeMap = [ - 'admin.posts.index' => 'index', - 'admin.posts.edit' => 'edit', + 'admin.posts.index' => 'index', + 'admin.posts.edit' => 'edit', ]; protected function index(Request $request): array { return [ - 'id' => $this->id, - 'title' => $this->title, - 'slug' => $this->slug, - 'created_at' => $this->created_at->toDateTimeString(), + 'id' => $this->id, + 'title' => $this->title, + 'slug' => $this->slug, + 'created_at' => $this->created_at->toDateTimeString(), 'published_at' => $this->published_at?->toDateTimeString(), - 'categories' => $this->categories, - 'trashed' => $this->trashed(), - 'status' => $this->status(), + 'categories' => $this->categories, + 'trashed' => $this->trashed(), + 'status' => $this->status(), ]; } protected function edit(Request $request): array { return [ - 'id' => $this->id, - 'title' => $this->getTranslations('title'), - 'description' => $this->getTranslations('description'), - 'slug' => $this->getTranslations('slug'), - 'author' => $this->author, - 'created_at' => $this->created_at->toDateTimeString(), + 'id' => $this->id, + 'title' => $this->getTranslations('title'), + 'description' => $this->getTranslations('description'), + 'slug' => $this->getTranslations('slug'), + 'author' => $this->author, + 'created_at' => $this->created_at->toDateTimeString(), 'published_at' => $this->published_at?->toDateTimeString(), - 'categories' => $this->categories->pluck('id'), - 'blocks' => BlockResource::collection($this->blocks), - 'media' => MediaResource::collection( + 'categories' => $this->categories->pluck('id'), + 'blocks' => BlockResource::collection($this->blocks), + 'media' => MediaResource::collection( $this->media()->whereIsOriginal()->get() ), ]; @@ -48,7 +48,7 @@ protected function edit(Request $request): array protected function default(Request $request): array { return [ - 'id' => $this->id, + 'id' => $this->id, 'title' => $this->title, ]; } diff --git a/app/Http/Resources/RelatedResource.php b/app/Http/Resources/RelatedResource.php index 2bfae6a4..d4a47881 100644 --- a/app/Http/Resources/RelatedResource.php +++ b/app/Http/Resources/RelatedResource.php @@ -17,8 +17,8 @@ protected function default(Request $request): array $this->withoutPermissions(); return [ - 'id' => $this->related_id, - 'type' => $this->related_type, + 'id' => $this->related_id, + 'type' => $this->related_type, 'title' => $this->related->name ?? $this->related->title, ]; } diff --git a/app/Http/Resources/UserResource.php b/app/Http/Resources/UserResource.php index 02c12285..9bf6b679 100644 --- a/app/Http/Resources/UserResource.php +++ b/app/Http/Resources/UserResource.php @@ -9,27 +9,27 @@ class UserResource extends Resource { public array $routeMap = [ - 'admin.users.index' => 'index', - 'admin.users.edit' => 'edit', + 'admin.users.index' => 'index', + 'admin.users.edit' => 'edit', ]; protected function index(Request $request): array { return [ - 'id' => $this->id, - 'name' => $this->name, + 'id' => $this->id, + 'name' => $this->name, 'email' => $this->email, - 'role' => $this->role, + 'role' => $this->role, ]; } protected function edit(Request $request): array { return [ - 'id' => $this->id, - 'name' => $this->name, - 'email' => $this->email, - 'role' => $this->role, + 'id' => $this->id, + 'name' => $this->name, + 'email' => $this->email, + 'role' => $this->role, 'locale' => $this->locale, ]; } @@ -37,7 +37,7 @@ protected function edit(Request $request): array protected function default(Request $request): array { return [ - 'id' => $this->id, + 'id' => $this->id, 'name' => $this->name, ]; } diff --git a/app/Mail/FormSubmitted.php b/app/Mail/FormSubmitted.php index f40e55c3..97d2c6aa 100644 --- a/app/Mail/FormSubmitted.php +++ b/app/Mail/FormSubmitted.php @@ -44,8 +44,8 @@ public function build() return $this ->subject($this->form->title) ->markdown('emails.forms.submitted', [ - 'form' => $this->form, - 'data' => $this->data, + 'form' => $this->form, + 'data' => $this->data, 'stored' => $this->stored, ]); } diff --git a/app/Models/Form.php b/app/Models/Form.php index 3f6e8068..b724f5c1 100644 --- a/app/Models/Form.php +++ b/app/Models/Form.php @@ -56,7 +56,7 @@ class Form extends Model public $casts = [ 'store_submissions' => 'boolean', - 'send_submissions' => 'boolean', + 'send_submissions' => 'boolean', ]; public string $allowedBlockType = 'form'; diff --git a/app/Models/Media.php b/app/Models/Media.php index 2f523a7c..f228c6c6 100644 --- a/app/Models/Media.php +++ b/app/Models/Media.php @@ -38,7 +38,7 @@ public static function booted() $image = Image::make($media->contents()); $media->forceFill([ - 'width' => $image->width(), + 'width' => $image->width(), 'height' => $image->height(), ]); } @@ -62,9 +62,9 @@ public function getSizesAttribute(): Collection } return $variants->map(fn (self $variant) => [ - 'width' => $variant->width, + 'width' => $variant->width, 'height' => $variant->height, - 'url' => $variant->getUrl(), + 'url' => $variant->getUrl(), ]); } diff --git a/app/Models/MenuItem.php b/app/Models/MenuItem.php index 9e16de3f..f6e3ba37 100644 --- a/app/Models/MenuItem.php +++ b/app/Models/MenuItem.php @@ -45,10 +45,10 @@ class MenuItem extends Model public static function allowedModels(): Collection { $models = [ - Page::class => true, - Post::class => true, - PostCategory::class => true, - Decision::class => Features::hasDecisions(), + Page::class => true, + Post::class => true, + PostCategory::class => true, + Decision::class => Features::hasDecisions(), DecisionCategory::class => Features::hasDecisions(), ]; diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 55a54cd0..6e27bd80 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -31,14 +31,14 @@ protected static function defaults(): Collection $sections = [ 'site' => [ - 'title' => $translatable, - 'description' => $translatable, + 'title' => $translatable, + 'description' => $translatable, 'default_locale' => Language::whereEnabled()->first()?->code, - 'front_page' => null, - 'privacy_page' => null, - 'terms_page' => null, - 'logo' => null, - 'favicon' => null, + 'front_page' => null, + 'privacy_page' => null, + 'terms_page' => null, + 'logo' => null, + 'favicon' => null, 'html' => [ 'header' => null, 'footer' => null, @@ -46,11 +46,11 @@ protected static function defaults(): Collection ], 'site-notice' => [ 'enabled' => false, - 'color' => null, - 'text' => $translatable, + 'color' => null, + 'text' => $translatable, ], 'social' => [ - 'profiles' => collect(config('website-factory.social_platforms')) + 'profiles' => collect(config('website-factory.social_platforms')) ->mapWithKeys(fn (array $config, string $id) => [$id => null]), ], ]; @@ -66,14 +66,14 @@ protected static function defaults(): Collection 'page' => [ 'thanks' => null, ], - 'amounts' => [], - 'mobilpay_enabled' => false, - 'mobilpay_signature' => null, + 'amounts' => [], + 'mobilpay_enabled' => false, + 'mobilpay_signature' => null, 'mobilpay_certificate' => null, 'mobilpay_private_key' => null, - 'euplatesc_enabled' => false, - 'euplatesc_mid' => null, - 'euplatesc_key' => null, + 'euplatesc_enabled' => false, + 'euplatesc_mid' => null, + 'euplatesc_key' => null, ]; } diff --git a/app/Payments/Euplatesc/Message/PurchaseRequest.php b/app/Payments/Euplatesc/Message/PurchaseRequest.php index 68b131c2..1fcc563b 100644 --- a/app/Payments/Euplatesc/Message/PurchaseRequest.php +++ b/app/Payments/Euplatesc/Message/PurchaseRequest.php @@ -17,13 +17,13 @@ public function getData(): array $this->validate('amount', 'returnUrl'); $data = [ - 'amount' => $this->getAmount(), - 'curr' => $this->getCurrency(), - 'invoice_id' => $this->getTransactionId(), - 'order_desc' => $this->getTransactionReference(), - 'merch_id' => $this->getMid(), - 'timestamp' => gmdate('YmdHis'), - 'nonce' => md5(microtime() . mt_rand()), + 'amount' => $this->getAmount(), + 'curr' => $this->getCurrency(), + 'invoice_id' => $this->getTransactionId(), + 'order_desc' => $this->getTransactionReference(), + 'merch_id' => $this->getMid(), + 'timestamp' => gmdate('YmdHis'), + 'nonce' => md5(microtime() . mt_rand()), ]; if ($this->getRecurring()) { diff --git a/app/Payments/Mobilpay/Message/PurchaseRequest.php b/app/Payments/Mobilpay/Message/PurchaseRequest.php index b90e4693..4b04f1ce 100644 --- a/app/Payments/Mobilpay/Message/PurchaseRequest.php +++ b/app/Payments/Mobilpay/Message/PurchaseRequest.php @@ -49,7 +49,7 @@ public function getData(): array $data = [ 'env_key' => $request->getEnvKey(), - 'data' => $request->getEncData(), + 'data' => $request->getEncData(), ]; return $data; diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index b0079881..07f90df2 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -37,23 +37,23 @@ public function register() public function boot() { Relation::enforceMorphMap([ - 'block' => \App\Models\Block::class, - 'decision_author' => \App\Models\DecisionAuthor::class, + 'block' => \App\Models\Block::class, + 'decision_author' => \App\Models\DecisionAuthor::class, 'decision_category' => \App\Models\DecisionCategory::class, - 'decision' => \App\Models\Decision::class, - 'form_field' => \App\Models\FormField::class, - 'form_submission' => \App\Models\FormSubmission::class, - 'form' => \App\Models\Form::class, - 'language' => \App\Models\Language::class, - 'media' => \App\Models\Media::class, - 'menu_item' => \App\Models\MenuItem::class, - 'page' => \App\Models\Page::class, - 'partner' => \App\Models\Partner::class, - 'person' => \App\Models\Person::class, - 'post_category' => \App\Models\PostCategory::class, - 'post' => \App\Models\Post::class, - 'setting' => \App\Models\Setting::class, - 'user' => \App\Models\User::class, + 'decision' => \App\Models\Decision::class, + 'form_field' => \App\Models\FormField::class, + 'form_submission' => \App\Models\FormSubmission::class, + 'form' => \App\Models\Form::class, + 'language' => \App\Models\Language::class, + 'media' => \App\Models\Media::class, + 'menu_item' => \App\Models\MenuItem::class, + 'page' => \App\Models\Page::class, + 'partner' => \App\Models\Partner::class, + 'person' => \App\Models\Person::class, + 'post_category' => \App\Models\PostCategory::class, + 'post' => \App\Models\Post::class, + 'setting' => \App\Models\Setting::class, + 'user' => \App\Models\User::class, ]); Validator::excludeUnvalidatedArrayKeys(); @@ -115,11 +115,11 @@ protected function registerInertiaMacros(): void return $this->with([ 'model' => [ - 'name' => $morphClass, + 'name' => $morphClass, 'admin_route_prefix' => 'admin.' . Str::plural($morphClass), 'front_route_prefix' => 'front.' . Str::plural($morphClass), - 'allowed_blocks' => $allowedBlocks ?? [], - 'translatable' => $translatable ?? [], + 'allowed_blocks' => $allowedBlocks ?? [], + 'translatable' => $translatable ?? [], ], ]); }); diff --git a/app/Providers/SettingsServiceProvider.php b/app/Providers/SettingsServiceProvider.php index 7a87403e..d5b21f05 100644 --- a/app/Providers/SettingsServiceProvider.php +++ b/app/Providers/SettingsServiceProvider.php @@ -54,9 +54,9 @@ protected function configureGatewayEuplatesc(): void } data_set($this->settings, 'payments.gateways.euplatesc', [ - 'driver' => '\App\Payments\Euplatesc\Gateway', + 'driver' => '\App\Payments\Euplatesc\Gateway', 'recurring' => true, - 'config' => [ + 'config' => [ 'mid' => $mid, 'key' => $key, ], @@ -78,12 +78,12 @@ protected function configureGatewayMobilpay(): void } data_set($this->settings, 'payments.gateways.mobilpay', [ - 'driver' => '\App\Payments\Mobilpay\Gateway', + 'driver' => '\App\Payments\Mobilpay\Gateway', 'recurring' => false, - 'config' => [ - 'signature' => $signature, + 'config' => [ + 'signature' => $signature, 'certificate' => $certificate, - 'privateKey' => $privateKey, + 'privateKey' => $privateKey, ], ]); } diff --git a/app/Services/BlockCollection.php b/app/Services/BlockCollection.php index dfe785b5..acf91005 100644 --- a/app/Services/BlockCollection.php +++ b/app/Services/BlockCollection.php @@ -46,10 +46,10 @@ private function getItems(string $type): ?Collection $type = $this->getProperty('type', $component) ?? Str::kebab(preg_replace('/(.vue|.js)$/u', '', $file->getFilename())); return [ - 'type' => $type, - 'icon' => $this->getProperty('icon', $component) ?? 'Design/layout-top-2-line', + 'type' => $type, + 'icon' => $this->getProperty('icon', $component) ?? 'Design/layout-top-2-line', 'feature' => $this->getProperty('feature', $component), - 'label' => __("block.$type"), + 'label' => __("block.$type"), ]; }) ->filter(fn (array $block) => \is_null($block['feature']) || Features::enabled($block['feature'])) diff --git a/app/Services/Help.php b/app/Services/Help.php index 89c86c6b..6be54518 100644 --- a/app/Services/Help.php +++ b/app/Services/Help.php @@ -36,12 +36,12 @@ public static function all(): Collection return [ 'sectionId' => (int) $sectionId, - 'section' => $section, - 'topic' => $topic, - 'title' => data_get($frontMatter, 'title'), - 'video' => (bool) data_get($frontMatter, 'video'), - 'content' => $content, - 'excerpt' => Str::of((string) $content) + 'section' => $section, + 'topic' => $topic, + 'title' => data_get($frontMatter, 'title'), + 'video' => (bool) data_get($frontMatter, 'video'), + 'content' => $content, + 'excerpt' => Str::of((string) $content) ->stripTags() ->limit(160) ->toString(), @@ -56,7 +56,7 @@ private static function getContentPath(string $locale): string $edition = match ($edition) { 'internal' => 'ong', - default => $edition, + default => $edition, }; return base_path("help/content/{$edition}/{$locale}"); diff --git a/app/Services/SupportsTrait.php b/app/Services/SupportsTrait.php index e58a8eee..d554ea24 100644 --- a/app/Services/SupportsTrait.php +++ b/app/Services/SupportsTrait.php @@ -9,17 +9,17 @@ class SupportsTrait { private static array $traitMap = [ - 'blocks' => \App\Traits\HasBlocks::class, - 'filterable' => \App\Traits\Filterable::class, - 'layout' => \App\Traits\HasLayout::class, - 'media' => \App\Traits\HasMedia::class, - 'nestedSet' => \Kalnoy\Nestedset\NodeTrait::class, - 'publishable' => \App\Traits\Publishable::class, - 'softDeletes' => \Illuminate\Database\Eloquent\SoftDeletes::class, - 'sortable' => \App\Traits\Sortable::class, - 'slug' => \App\Traits\HasSlug::class, + 'blocks' => \App\Traits\HasBlocks::class, + 'filterable' => \App\Traits\Filterable::class, + 'layout' => \App\Traits\HasLayout::class, + 'media' => \App\Traits\HasMedia::class, + 'nestedSet' => \Kalnoy\Nestedset\NodeTrait::class, + 'publishable' => \App\Traits\Publishable::class, + 'softDeletes' => \Illuminate\Database\Eloquent\SoftDeletes::class, + 'sortable' => \App\Traits\Sortable::class, + 'slug' => \App\Traits\HasSlug::class, 'translatable' => \App\Traits\Translatable::class, - 'uuid' => \App\Traits\HasUuid::class, + 'uuid' => \App\Traits\HasUuid::class, ]; public static function __callStatic(string $method, array $args): bool diff --git a/app/Traits/Duplicatable.php b/app/Traits/Duplicatable.php index c7e0df84..19e9b890 100644 --- a/app/Traits/Duplicatable.php +++ b/app/Traits/Duplicatable.php @@ -11,7 +11,6 @@ trait Duplicatable { public function duplicate(): Model { - /** @var Model */ $duplicate = $this->replicate(); diff --git a/app/Traits/HasBlocks.php b/app/Traits/HasBlocks.php index b7a372ff..b1177946 100644 --- a/app/Traits/HasBlocks.php +++ b/app/Traits/HasBlocks.php @@ -22,14 +22,14 @@ public function saveBlocks(iterable $blocks): Model $this->blocks->map->delete(); $blocks = collect($blocks)->map(fn (array $block, int $index) => [ - 'blockable_id' => $this->id, + 'blockable_id' => $this->id, 'blockable_type' => $this->getMorphClass(), - 'position' => $index + 1, - 'type' => $block['type'], - 'content' => $block['content'] ?? [], - 'children' => $block['children'] ?? [], - 'media' => collect($block['media'] ?? [])->pluck('id')->all(), - 'related' => $block['related'] ?? [], + 'position' => $index + 1, + 'type' => $block['type'], + 'content' => $block['content'] ?? [], + 'children' => $block['children'] ?? [], + 'media' => collect($block['media'] ?? [])->pluck('id')->all(), + 'related' => $block['related'] ?? [], ]); $this->blocks()->createMany($blocks) @@ -40,14 +40,14 @@ public function saveBlocks(iterable $blocks): Model $children = collect($currentBlock['children']) ->map(fn (array $block, int $index) => [ - 'blockable_id' => $this->id, + 'blockable_id' => $this->id, 'blockable_type' => $this->getMorphClass(), - 'position' => $index + 1, - 'type' => $block['type'], - 'content' => $block['content'] ?? [], - 'children' => $block['children'] ?? [], - 'media' => collect($block['media'] ?? [])->pluck('id')->all(), - 'related' => $block['related'] ?? [], + 'position' => $index + 1, + 'type' => $block['type'], + 'content' => $block['content'] ?? [], + 'children' => $block['children'] ?? [], + 'media' => collect($block['media'] ?? [])->pluck('id')->all(), + 'related' => $block['related'] ?? [], ]); $block->children()->createMany($children) diff --git a/app/Traits/HasRelated.php b/app/Traits/HasRelated.php index 9cc9178f..b4e2b0e5 100644 --- a/app/Traits/HasRelated.php +++ b/app/Traits/HasRelated.php @@ -27,9 +27,9 @@ public function saveRelated(array $items): void { $this->related()->createMany( collect($items)->map(fn (array $item, int $index) => [ - 'related_id' => $item['related_id'] ?? $item['id'], + 'related_id' => $item['related_id'] ?? $item['id'], 'related_type' => $item['related_type'] ?? $item['type'], - 'position' => $item['position'] ?? $index + 1, + 'position' => $item['position'] ?? $index + 1, ]) ); } diff --git a/app/Traits/HasSlug.php b/app/Traits/HasSlug.php index f4407f4f..c7fc4f00 100644 --- a/app/Traits/HasSlug.php +++ b/app/Traits/HasSlug.php @@ -157,7 +157,7 @@ public function getUrlAttribute(): ?string return route('front.' . Str::plural($key) . '.show', [ 'locale' => app()->getLocale(), - $key => $slug, + $key => $slug, ]); } } diff --git a/app/View/Components/Blocks/Carousel.php b/app/View/Components/Blocks/Carousel.php index 59ccf637..3604a96a 100644 --- a/app/View/Components/Blocks/Carousel.php +++ b/app/View/Components/Blocks/Carousel.php @@ -19,14 +19,14 @@ public function setup(): void $image = $block->firstMedia('image'); $item = [ - 'title' => $block->translatedInput('title'), - 'text' => $block->translatedInput('text'), - 'image' => $image, + 'title' => $block->translatedInput('title'), + 'text' => $block->translatedInput('text'), + 'image' => $image, 'color_overlay_enabled' => $image !== null ? $block->checkbox('color_overlay_enabled') : false, - 'color_overlay' => $image !== null ? $block->input('color_overlay') : false, - 'image_as_background' => $image !== null ? $block->checkbox('image_as_background') : false, - 'button_url' => $block->translatedInput('button_url'), - 'button_text' => $block->translatedInput('button_text'), + 'color_overlay' => $image !== null ? $block->input('color_overlay') : false, + 'image_as_background' => $image !== null ? $block->checkbox('image_as_background') : false, + 'button_url' => $block->translatedInput('button_url'), + 'button_text' => $block->translatedInput('button_text'), ]; $item['component'] = $this->getComponent($item); diff --git a/app/View/Components/Blocks/Html.php b/app/View/Components/Blocks/Html.php index e1b30a36..bef5f4b4 100644 --- a/app/View/Components/Blocks/Html.php +++ b/app/View/Components/Blocks/Html.php @@ -19,22 +19,22 @@ public function setup(): void $this->code = $this->block->input('code'); $this->aspectRatio = match ($this->block->input('aspect_ratio')) { - '1/1' => 'aspect-w-1 aspect-h-1', - '5/4' => 'aspect-w-5 aspect-h-4', - '4/3' => 'aspect-w-4 aspect-h-3', - '3/2' => 'aspect-w-3 aspect-h-2', - '5/3' => 'aspect-w-5 aspect-h-3', - '16/9' => 'aspect-w-16 aspect-h-9', - '2/1' => 'aspect-w-2 aspect-h-1', - '3/1' => 'aspect-w-3 aspect-h-1', - '5/6' => 'aspect-w-5 aspect-h-6', - '4/5' => 'aspect-w-4 aspect-h-5', - '3/4' => 'aspect-w-3 aspect-h-4', - '2/3' => 'aspect-w-2 aspect-h-3', - '3/5' => 'aspect-w-3 aspect-h-5', - '9/16' => 'aspect-w-9 aspect-h-16', - '1/2' => 'aspect-w-1 aspect-h-2', - '1/3' => 'aspect-w-1 aspect-h-3', + '1/1' => 'aspect-w-1 aspect-h-1', + '5/4' => 'aspect-w-5 aspect-h-4', + '4/3' => 'aspect-w-4 aspect-h-3', + '3/2' => 'aspect-w-3 aspect-h-2', + '5/3' => 'aspect-w-5 aspect-h-3', + '16/9' => 'aspect-w-16 aspect-h-9', + '2/1' => 'aspect-w-2 aspect-h-1', + '3/1' => 'aspect-w-3 aspect-h-1', + '5/6' => 'aspect-w-5 aspect-h-6', + '4/5' => 'aspect-w-4 aspect-h-5', + '3/4' => 'aspect-w-3 aspect-h-4', + '2/3' => 'aspect-w-2 aspect-h-3', + '3/5' => 'aspect-w-3 aspect-h-5', + '9/16' => 'aspect-w-9 aspect-h-16', + '1/2' => 'aspect-w-1 aspect-h-2', + '1/3' => 'aspect-w-1 aspect-h-3', default => '', }; } diff --git a/app/View/Components/Blocks/ImagesWithLinks.php b/app/View/Components/Blocks/ImagesWithLinks.php index 82e293e7..ee0bcd3d 100644 --- a/app/View/Components/Blocks/ImagesWithLinks.php +++ b/app/View/Components/Blocks/ImagesWithLinks.php @@ -28,9 +28,9 @@ public function setup(): void $this->items = $this->block->children ->loadMissing('media') ->map(fn (Block $block) => [ - 'url' => $block->translatedInput('url'), + 'url' => $block->translatedInput('url'), 'caption' => $block->translatedInput('caption'), - 'image' => $block->firstMedia('image'), + 'image' => $block->firstMedia('image'), ]); } } diff --git a/app/helpers.php b/app/helpers.php index da5b69d5..ca183495 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -123,8 +123,8 @@ function color_var(?string $hex, string $name): string $hex = ltrim((string) $hex, '#'); $rgb = match (Str::length($hex)) { - 3 => str_split($hex, 1), - 6 => str_split($hex, 2), + 3 => str_split($hex, 1), + 6 => str_split($hex, 2), default => str_split('000', 1), }; diff --git a/config/excel.php b/config/excel.php index 4fb2639b..5ed8ca77 100644 --- a/config/excel.php +++ b/config/excel.php @@ -16,7 +16,7 @@ | Here you can specify how big the chunk should be. | */ - 'chunk_size' => 1000, + 'chunk_size' => 1000, /* |-------------------------------------------------------------------------- @@ -43,14 +43,14 @@ | Configure e.g. delimiter, enclosure and line ending for CSV exports. | */ - 'csv' => [ - 'delimiter' => ',', - 'enclosure' => '"', - 'line_ending' => PHP_EOL, - 'use_bom' => false, + 'csv' => [ + 'delimiter' => ',', + 'enclosure' => '"', + 'line_ending' => PHP_EOL, + 'use_bom' => false, 'include_separator_line' => false, - 'excel_compatibility' => false, - 'output_encoding' => '', + 'excel_compatibility' => false, + 'output_encoding' => '', ], /* @@ -61,20 +61,20 @@ | Configure e.g. default title, creator, subject,... | */ - 'properties' => [ - 'creator' => '', + 'properties' => [ + 'creator' => '', 'lastModifiedBy' => '', - 'title' => '', - 'description' => '', - 'subject' => '', - 'keywords' => '', - 'category' => '', - 'manager' => '', - 'company' => '', + 'title' => '', + 'description' => '', + 'subject' => '', + 'keywords' => '', + 'category' => '', + 'manager' => '', + 'company' => '', ], ], - 'imports' => [ + 'imports' => [ /* |-------------------------------------------------------------------------- @@ -123,12 +123,12 @@ | Configure e.g. delimiter, enclosure and line ending for CSV imports. | */ - 'csv' => [ - 'delimiter' => null, - 'enclosure' => '"', + 'csv' => [ + 'delimiter' => null, + 'enclosure' => '"', 'escape_character' => '\\', - 'contiguous' => false, - 'input_encoding' => 'UTF-8', + 'contiguous' => false, + 'input_encoding' => 'UTF-8', ], /* @@ -139,16 +139,16 @@ | Configure e.g. default title, creator, subject,... | */ - 'properties' => [ - 'creator' => '', + 'properties' => [ + 'creator' => '', 'lastModifiedBy' => '', - 'title' => '', - 'description' => '', - 'subject' => '', - 'keywords' => '', - 'category' => '', - 'manager' => '', - 'company' => '', + 'title' => '', + 'description' => '', + 'subject' => '', + 'keywords' => '', + 'category' => '', + 'manager' => '', + 'company' => '', ], ], @@ -163,21 +163,21 @@ | */ 'extension_detector' => [ - 'xlsx' => Excel::XLSX, - 'xlsm' => Excel::XLSX, - 'xltx' => Excel::XLSX, - 'xltm' => Excel::XLSX, - 'xls' => Excel::XLS, - 'xlt' => Excel::XLS, - 'ods' => Excel::ODS, - 'ots' => Excel::ODS, - 'slk' => Excel::SLK, - 'xml' => Excel::XML, + 'xlsx' => Excel::XLSX, + 'xlsm' => Excel::XLSX, + 'xltx' => Excel::XLSX, + 'xltm' => Excel::XLSX, + 'xls' => Excel::XLS, + 'xlt' => Excel::XLS, + 'ods' => Excel::ODS, + 'ots' => Excel::ODS, + 'slk' => Excel::SLK, + 'xml' => Excel::XML, 'gnumeric' => Excel::GNUMERIC, - 'htm' => Excel::HTML, - 'html' => Excel::HTML, - 'csv' => Excel::CSV, - 'tsv' => Excel::TSV, + 'htm' => Excel::HTML, + 'html' => Excel::HTML, + 'csv' => Excel::CSV, + 'tsv' => Excel::TSV, /* |-------------------------------------------------------------------------- @@ -188,7 +188,7 @@ | Available options: Excel::MPDF | Excel::TCPDF | Excel::DOMPDF | */ - 'pdf' => Excel::DOMPDF, + 'pdf' => Excel::DOMPDF, ], /* @@ -229,7 +229,7 @@ | Drivers: memory|illuminate|batch | */ - 'driver' => 'memory', + 'driver' => 'memory', /* |-------------------------------------------------------------------------- @@ -241,7 +241,7 @@ | Here you can tweak the memory limit to your liking. | */ - 'batch' => [ + 'batch' => [ 'memory_limit' => 60000, ], @@ -279,7 +279,7 @@ */ 'transactions' => [ 'handler' => 'db', - 'db' => [ + 'db' => [ 'connection' => null, ], ], @@ -295,7 +295,7 @@ | storing reading or downloading. Here you can customize that path. | */ - 'local_path' => storage_path('framework/cache/laravel-excel'), + 'local_path' => storage_path('framework/cache/laravel-excel'), /* |-------------------------------------------------------------------------- @@ -311,8 +311,8 @@ | in conjunction with queued imports and exports. | */ - 'remote_disk' => null, - 'remote_prefix' => null, + 'remote_disk' => null, + 'remote_prefix' => null, /* |-------------------------------------------------------------------------- diff --git a/config/website-factory.php b/config/website-factory.php index 028f6ede..da8d07c1 100644 --- a/config/website-factory.php +++ b/config/website-factory.php @@ -12,34 +12,34 @@ 'social_platforms' => [ 'facebook' => [ - 'label' => 'Facebook', + 'label' => 'Facebook', 'prefix' => 'https://www.facebook.com/', - 'icon' => 'ri-facebook-fill', + 'icon' => 'ri-facebook-fill', ], 'linkedin' => [ - 'label' => 'LinkedIn', + 'label' => 'LinkedIn', 'prefix' => 'https://www.linkedin.com/', - 'icon' => 'ri-linkedin-fill', + 'icon' => 'ri-linkedin-fill', ], 'instagram' => [ - 'label' => 'Instagram', + 'label' => 'Instagram', 'prefix' => 'https://www.instagram.com/', - 'icon' => 'ri-instagram-line', + 'icon' => 'ri-instagram-line', ], 'twitter' => [ - 'label' => 'Twitter', + 'label' => 'Twitter', 'prefix' => 'https://twitter.com/', - 'icon' => 'ri-twitter-fill', + 'icon' => 'ri-twitter-fill', ], 'youtube' => [ - 'label' => 'YouTube', + 'label' => 'YouTube', 'prefix' => 'https://youtube.com/', - 'icon' => 'ri-youtube-fill', + 'icon' => 'ri-youtube-fill', ], 'github' => [ - 'label' => 'GitHub', + 'label' => 'GitHub', 'prefix' => 'https://github.com/', - 'icon' => 'ri-github-fill', + 'icon' => 'ri-github-fill', ], ], diff --git a/database/factories/BlockFactory.php b/database/factories/BlockFactory.php index e78898f4..b7e098bf 100644 --- a/database/factories/BlockFactory.php +++ b/database/factories/BlockFactory.php @@ -14,9 +14,9 @@ class BlockFactory extends Factory public function definition(): array { return [ - 'type' => null, - 'position' => $this->faker->randomDigit(), - 'content' => [], + 'type' => null, + 'position' => $this->faker->randomDigit(), + 'content' => [], 'parent_id' => null, ]; } diff --git a/database/factories/DecisionCategoryFactory.php b/database/factories/DecisionCategoryFactory.php index 65e783cb..f90499ef 100644 --- a/database/factories/DecisionCategoryFactory.php +++ b/database/factories/DecisionCategoryFactory.php @@ -14,10 +14,10 @@ class DecisionCategoryFactory extends Factory public function definition(): array { return [ - 'title' => $this->translatedFaker('word'), - 'slug' => $this->translatedFaker('slug'), - 'description' => $this->translatedFaker('text'), - 'deleted_at' => $this->faker->boolean(5) ? $this->faker->dateTime() : null, + 'title' => $this->translatedFaker('word'), + 'slug' => $this->translatedFaker('slug'), + 'description' => $this->translatedFaker('text'), + 'deleted_at' => $this->faker->boolean(5) ? $this->faker->dateTime() : null, ]; } } diff --git a/database/factories/DecisionFactory.php b/database/factories/DecisionFactory.php index 32324cab..f90c90de 100644 --- a/database/factories/DecisionFactory.php +++ b/database/factories/DecisionFactory.php @@ -14,11 +14,11 @@ class DecisionFactory extends Factory public function definition() { return [ - 'title' => $this->translatedFaker('sentence'), - 'slug' => $this->translatedFaker('slug'), - 'description' => $this->translatedFaker('text'), + 'title' => $this->translatedFaker('sentence'), + 'slug' => $this->translatedFaker('slug'), + 'description' => $this->translatedFaker('text'), 'published_at' => $this->faker->boolean(95) ? $this->faker->dateTimeThisYear() : null, - 'deleted_at' => $this->faker->boolean(5) ? $this->faker->dateTime() : null, + 'deleted_at' => $this->faker->boolean(5) ? $this->faker->dateTime() : null, ]; } } diff --git a/database/factories/FormFactory.php b/database/factories/FormFactory.php index 544665ad..ff258f7d 100644 --- a/database/factories/FormFactory.php +++ b/database/factories/FormFactory.php @@ -18,11 +18,11 @@ public function definition(): array $send_submissions = $this->faker->boolean(); return [ - 'title' => $this->translatedFaker('sentence'), - 'slug' => $this->translatedFaker('slug'), + 'title' => $this->translatedFaker('sentence'), + 'slug' => $this->translatedFaker('slug'), 'store_submissions' => $this->faker->boolean(), - 'send_submissions' => $send_submissions, - 'recipients' => $send_submissions ? collect([ + 'send_submissions' => $send_submissions, + 'recipients' => $send_submissions ? collect([ $this->faker->safeEmail(), $this->faker->safeEmail(), $this->faker->safeEmail(), @@ -42,13 +42,13 @@ public function withField(array $field = []): self } $form->blocks()->create([ - 'blockable_id' => $form->id, + 'blockable_id' => $form->id, 'blockable_type' => $form->getMorphClass(), - 'position' => 1, - 'type' => $type, - 'content' => array_merge([ + 'position' => 1, + 'type' => $type, + 'content' => array_merge([ 'label' => $this->translatedFaker('word'), - 'help' => $this->translatedFaker('sentence'), + 'help' => $this->translatedFaker('sentence'), ], $field), ]); }); diff --git a/database/factories/MenuItemFactory.php b/database/factories/MenuItemFactory.php index 5821e69a..becbc106 100644 --- a/database/factories/MenuItemFactory.php +++ b/database/factories/MenuItemFactory.php @@ -14,9 +14,9 @@ class MenuItemFactory extends Factory public function definition() { return [ - 'location' => $this->faker->randomElement(['header', 'footer']), - 'label' => $this->translatedFaker('word'), - 'position' => $this->faker->randomDigit(), + 'location' => $this->faker->randomElement(['header', 'footer']), + 'label' => $this->translatedFaker('word'), + 'position' => $this->faker->randomDigit(), 'parent_id' => null, ]; } @@ -39,7 +39,7 @@ public function external(): self { return $this->state(fn (array $attributes) => [ 'type' => 'external', - 'url' => 'https://example.com/', + 'url' => 'https://example.com/', ]); } } diff --git a/database/factories/PageFactory.php b/database/factories/PageFactory.php index 872cbf28..bfeb6285 100644 --- a/database/factories/PageFactory.php +++ b/database/factories/PageFactory.php @@ -14,11 +14,11 @@ class PageFactory extends Factory public function definition(): array { return [ - 'title' => $this->translatedFaker('sentence'), - 'slug' => $this->translatedFaker('slug'), - 'description' => $this->translatedFaker('text'), + 'title' => $this->translatedFaker('sentence'), + 'slug' => $this->translatedFaker('slug'), + 'description' => $this->translatedFaker('text'), 'published_at' => $this->faker->boolean(95) ? $this->faker->dateTimeThisYear() : null, - 'deleted_at' => $this->faker->boolean(5) ? $this->faker->dateTime() : null, + 'deleted_at' => $this->faker->boolean(5) ? $this->faker->dateTime() : null, ]; } } diff --git a/database/factories/PartnerFactory.php b/database/factories/PartnerFactory.php index c9b11251..3d509066 100644 --- a/database/factories/PartnerFactory.php +++ b/database/factories/PartnerFactory.php @@ -19,8 +19,8 @@ class PartnerFactory extends Factory public function definition() { return [ - 'name' => $this->faker->company(), - 'url' => $this->faker->url(), + 'name' => $this->faker->company(), + 'url' => $this->faker->url(), 'position' => $this->faker->randomDigitNotZero(), ]; } diff --git a/database/factories/PersonFactory.php b/database/factories/PersonFactory.php index 2312b63f..2228448c 100644 --- a/database/factories/PersonFactory.php +++ b/database/factories/PersonFactory.php @@ -18,11 +18,11 @@ public function definition() $name = $this->faker->name(); return [ - 'name' => $name, - 'slug' => Str::slug($name), - 'title' => $this->translatedFaker('jobTitle'), - 'description' => $this->translatedFaker('realText'), - 'deleted_at' => $this->faker->boolean(5) ? $this->faker->dateTime() : null, + 'name' => $name, + 'slug' => Str::slug($name), + 'title' => $this->translatedFaker('jobTitle'), + 'description' => $this->translatedFaker('realText'), + 'deleted_at' => $this->faker->boolean(5) ? $this->faker->dateTime() : null, ]; } } diff --git a/database/factories/PostCategoryFactory.php b/database/factories/PostCategoryFactory.php index aafe25bd..b4942ab4 100644 --- a/database/factories/PostCategoryFactory.php +++ b/database/factories/PostCategoryFactory.php @@ -14,10 +14,10 @@ class PostCategoryFactory extends Factory public function definition(): array { return [ - 'title' => $this->translatedFaker('word'), - 'slug' => $this->translatedFaker('slug'), - 'description' => $this->translatedFaker('text'), - 'deleted_at' => $this->faker->boolean(5) ? $this->faker->dateTime() : null, + 'title' => $this->translatedFaker('word'), + 'slug' => $this->translatedFaker('slug'), + 'description' => $this->translatedFaker('text'), + 'deleted_at' => $this->faker->boolean(5) ? $this->faker->dateTime() : null, ]; } } diff --git a/database/factories/PostFactory.php b/database/factories/PostFactory.php index 2b0f0e68..713c672d 100644 --- a/database/factories/PostFactory.php +++ b/database/factories/PostFactory.php @@ -14,11 +14,11 @@ class PostFactory extends Factory public function definition(): array { return [ - 'title' => $this->translatedFaker('sentence'), - 'slug' => $this->translatedFaker('slug'), - 'description' => $this->translatedFaker('text'), + 'title' => $this->translatedFaker('sentence'), + 'slug' => $this->translatedFaker('slug'), + 'description' => $this->translatedFaker('text'), 'published_at' => $this->faker->boolean(95) ? $this->faker->dateTimeThisYear() : null, - 'deleted_at' => $this->faker->boolean(5) ? $this->faker->dateTime() : null, + 'deleted_at' => $this->faker->boolean(5) ? $this->faker->dateTime() : null, ]; } } diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index b4da70ea..ba2426f2 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -17,13 +17,13 @@ class UserFactory extends Factory public function definition(): array { return [ - 'name' => $this->faker->name(), - 'email' => $this->faker->unique()->safeEmail(), + 'name' => $this->faker->name(), + 'email' => $this->faker->unique()->safeEmail(), 'email_verified_at' => now(), - 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password - 'remember_token' => Str::random(10), - 'role' => null, - 'locale' => config('app.locale'), + 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password + 'remember_token' => Str::random(10), + 'role' => null, + 'locale' => config('app.locale'), ]; } diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 6a9154cc..5ad40857 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -32,13 +32,13 @@ public function run() Language::insert([ [ - 'code' => 'ro', - 'name' => 'Română', + 'code' => 'ro', + 'name' => 'Română', 'enabled' => true, ], [ - 'code' => 'en', - 'name' => 'English', + 'code' => 'en', + 'name' => 'English', 'enabled' => false, ], ]); diff --git a/lang/en/banner.php b/lang/en/banner.php index 80932a44..56d97485 100644 --- a/lang/en/banner.php +++ b/lang/en/banner.php @@ -10,8 +10,8 @@ 'edition' => [ 'primarie' => 'Primărie', 'minister' => 'Minister', - 'ong' => 'ONG', - 'develop' => 'develop', + 'ong' => 'ONG', + 'develop' => 'develop', ], ]; diff --git a/lang/en/error.php b/lang/en/error.php index 14f1bb4f..8611c3d9 100644 --- a/lang/en/error.php +++ b/lang/en/error.php @@ -5,31 +5,31 @@ return [ 401 => [ - 'title' => 'Unauthorized', + 'title' => 'Unauthorized', 'message' => 'Sorry, you are not authorized to access this page.', ], 403 => [ - 'title' => 'Forbidden', + 'title' => 'Forbidden', 'message' => 'Sorry, you are forbidden from accessing this page.', ], 404 => [ - 'title' => 'Not found', + 'title' => 'Not found', 'message' => 'Sorry, the page you are looking for could not be found.', ], 419 => [ - 'title' => 'Expired session', + 'title' => 'Expired session', 'message' => 'Sorry, your session has expired. Please refresh and try again.', ], 429 => [ - 'title' => 'Too Many Requests', + 'title' => 'Too Many Requests', 'message' => 'Sorry, you are making too many requests to our servers.', ], 500 => [ - 'title' => 'Internal Server Error', + 'title' => 'Internal Server Error', 'message' => 'Whoops, something went wrong on our servers.', ], 503 => [ - 'title' => 'Service Unavailable', + 'title' => 'Service Unavailable', 'message' => 'Sorry, we are doing some maintenance. Please check back soon.', ], diff --git a/lang/ro/banner.php b/lang/ro/banner.php index fea6ef7c..a4c2b22a 100644 --- a/lang/ro/banner.php +++ b/lang/ro/banner.php @@ -10,8 +10,8 @@ 'edition' => [ 'primarie' => 'Primărie', 'minister' => 'Minister', - 'ong' => 'ONG', - 'develop' => 'develop', + 'ong' => 'ONG', + 'develop' => 'develop', ], 'government' => 'Website creat cu Website Factory: Guvern. O soluție dezvoltată de Asociația Code for Romania (Commit Global) și pusă gratuit la dispoziția administrației publice.', diff --git a/lang/ro/error.php b/lang/ro/error.php index a5d43ca7..b6c6671d 100644 --- a/lang/ro/error.php +++ b/lang/ro/error.php @@ -5,31 +5,31 @@ return [ 401 => [ - 'title' => 'Neautorizat', + 'title' => 'Neautorizat', 'message' => 'Ne pare rău, nu ești autorizat să accesezi această pagină.', ], 403 => [ - 'title' => 'Interzis', + 'title' => 'Interzis', 'message' => 'Ne pare rău, nu ai dreptul să accesezi această pagină.', ], 404 => [ - 'title' => 'Nu am găsit pagina', + 'title' => 'Nu am găsit pagina', 'message' => 'Ne pare rău, nu am găsit pagina pe care o cauți.', ], 419 => [ - 'title' => 'Sesiune expirată', + 'title' => 'Sesiune expirată', 'message' => 'Ne pare rău, sesiunea ta a expirat. Te rugăm să încerci din nou.', ], 429 => [ - 'title' => 'Prea multe request-uri', + 'title' => 'Prea multe request-uri', 'message' => 'Ne pare rău, faci prea multe request-uri către serverele noastre.', ], 500 => [ - 'title' => 'Eroare internă a serverelor', + 'title' => 'Eroare internă a serverelor', 'message' => 'Oops, ceva nu a mers bine pe serverele noastre.', ], 503 => [ - 'title' => 'Serviciu indisponibil', + 'title' => 'Serviciu indisponibil', 'message' => 'Ne pare rău, lucrăm la întreținerea site-ului. Te rugăm să încerci mai târziu.', ], diff --git a/lang/ru/banner.php b/lang/ru/banner.php index cc04008c..3bb129af 100644 --- a/lang/ru/banner.php +++ b/lang/ru/banner.php @@ -10,8 +10,8 @@ 'edition' => [ 'primarie' => 'Primărie', 'minister' => 'Minister', - 'ong' => 'NGO', - 'develop' => 'develop', + 'ong' => 'NGO', + 'develop' => 'develop', ], ]; diff --git a/lang/uk/banner.php b/lang/uk/banner.php index 98894ba2..e521f531 100644 --- a/lang/uk/banner.php +++ b/lang/uk/banner.php @@ -10,8 +10,8 @@ 'edition' => [ 'primarie' => 'Primărie', 'minister' => 'Minister', - 'ong' => 'NGO', - 'develop' => 'develop', + 'ong' => 'NGO', + 'develop' => 'develop', ], ]; diff --git a/routes/admin.php b/routes/admin.php index 358272e7..59282ae1 100644 --- a/routes/admin.php +++ b/routes/admin.php @@ -27,8 +27,8 @@ ->name('i18n'); Route::group([ - 'prefix' => 'pages', - 'as' => 'pages.', + 'prefix' => 'pages', + 'as' => 'pages.', 'controller' => Admin\PageController::class, ], function () { Route::get('/', 'index')->name('index'); @@ -44,8 +44,8 @@ }); Route::group([ - 'prefix' => 'people', - 'as' => 'people.', + 'prefix' => 'people', + 'as' => 'people.', 'controller' => Admin\PersonController::class, ], function () { Route::get('/', 'index')->name('index'); @@ -63,8 +63,8 @@ Route::prefix('posts')->group(function () { Route::group([ - 'prefix' => 'categories', - 'as' => 'post_categories.', + 'prefix' => 'categories', + 'as' => 'post_categories.', 'controller' => Admin\PostCategoryController::class, ], function () { Route::get('/', 'index')->name('index'); @@ -80,7 +80,7 @@ }); Route::group([ - 'as' => 'posts.', + 'as' => 'posts.', 'controller' => Admin\PostController::class, ], function () { Route::get('/', 'index')->name('index'); @@ -99,8 +99,8 @@ if (Features::hasDecisions()) { Route::prefix('decisions')->group(function () { Route::group([ - 'prefix' => 'categories', - 'as' => 'decision_categories.', + 'prefix' => 'categories', + 'as' => 'decision_categories.', 'controller' => Admin\DecisionCategoryController::class, ], function () { Route::get('/', 'index')->name('index'); @@ -116,8 +116,8 @@ }); Route::group([ - 'prefix' => 'authors', - 'as' => 'decision_authors.', + 'prefix' => 'authors', + 'as' => 'decision_authors.', 'controller' => Admin\DecisionAuthorController::class, ], function () { Route::get('/', 'index')->name('index'); @@ -133,7 +133,7 @@ }); Route::group([ - 'as' => 'decisions.', + 'as' => 'decisions.', 'controller' => Admin\DecisionController::class, ], function () { Route::get('/', 'index')->name('index'); @@ -151,8 +151,8 @@ } Route::group([ - 'prefix' => 'forms', - 'as' => 'forms.', + 'prefix' => 'forms', + 'as' => 'forms.', 'controller' => Admin\FormController::class, ], function () { Route::get('/', 'index')->name('index'); @@ -171,7 +171,7 @@ }); Route::group([ - 'as' => 'form_submissions.', + 'as' => 'form_submissions.', 'controller' => Admin\FormSubmissionController::class, ], function () { Route::get('form_submission/{form_submission}', 'show')->name('show'); @@ -179,8 +179,8 @@ }); Route::group([ - 'prefix' => 'users', - 'as' => 'users.', + 'prefix' => 'users', + 'as' => 'users.', 'controller' => Admin\UserController::class, 'middleware' => 'role:admin', ], function () { @@ -193,8 +193,8 @@ }); Route::group([ - 'prefix' => 'media', - 'as' => 'media.', + 'prefix' => 'media', + 'as' => 'media.', 'controller' => Admin\MediaController::class, ], function () { Route::get('/images', 'images')->name('images'); @@ -205,8 +205,8 @@ }); Route::group([ - 'prefix' => 'partners', - 'as' => 'partners.', + 'prefix' => 'partners', + 'as' => 'partners.', 'controller' => Admin\PartnerController::class, 'middleware' => 'role:admin', ], function () { @@ -223,11 +223,11 @@ }); Route::group([ - 'prefix' => 'menus', - 'as' => 'menus.', + 'prefix' => 'menus', + 'as' => 'menus.', 'controller' => Admin\MenuController::class, 'middleware' => 'role:admin', - 'where' => ['location' => '(header|footer)'], + 'where' => ['location' => '(header|footer)'], ], function () { Route::get('/', 'index')->name('index'); Route::get('/{location}', 'edit')->name('edit'); @@ -235,8 +235,8 @@ }); Route::group([ - 'prefix' => 'settings', - 'as' => 'settings.', + 'prefix' => 'settings', + 'as' => 'settings.', 'controller' => Admin\SettingController::class, 'middleware' => 'role:admin', ], function () { @@ -246,8 +246,8 @@ }); Route::group([ - 'prefix' => 'languages', - 'as' => 'languages.', + 'prefix' => 'languages', + 'as' => 'languages.', 'controller' => Admin\LanguageController::class, 'middleware' => 'role:admin', ], function () { diff --git a/tests/Feature/FormTest.php b/tests/Feature/FormTest.php index 86e70560..defef05a 100644 --- a/tests/Feature/FormTest.php +++ b/tests/Feature/FormTest.php @@ -98,49 +98,49 @@ public function fields(): array // Text 'text-required' => [ [ - 'type' => 'text', - 'required' => true, + 'type' => 'text', + 'required' => true, 'min_length' => null, 'max_length' => null, ], [ - 'valid' => 'Test', + 'valid' => 'Test', 'invalid' => null, ], ], 'text-optional' => [ [ - 'type' => 'text', - 'required' => false, + 'type' => 'text', + 'required' => false, 'min_length' => null, 'max_length' => null, ], [ - 'valid' => null, + 'valid' => null, 'invalid' => [], ], ], 'text-min' => [ [ - 'type' => 'text', - 'required' => false, + 'type' => 'text', + 'required' => false, 'min_length' => 25, 'max_length' => null, ], [ - 'valid' => 'This text is long enough to validate', + 'valid' => 'This text is long enough to validate', 'invalid' => 'This is too short', ], ], 'text-max' => [ [ - 'type' => 'text', - 'required' => false, + 'type' => 'text', + 'required' => false, 'min_length' => null, 'max_length' => 25, ], [ - 'valid' => 'This is short enough', + 'valid' => 'This is short enough', 'invalid' => 'This is way too much text to validate', ], ], @@ -148,49 +148,49 @@ public function fields(): array // Textarea 'textarea-required' => [ [ - 'type' => 'textarea', - 'required' => true, + 'type' => 'textarea', + 'required' => true, 'min_length' => null, 'max_length' => null, ], [ - 'valid' => 'Test', + 'valid' => 'Test', 'invalid' => null, ], ], 'textarea-optional' => [ [ - 'type' => 'textarea', - 'required' => false, + 'type' => 'textarea', + 'required' => false, 'min_length' => null, 'max_length' => null, ], [ - 'valid' => null, + 'valid' => null, 'invalid' => [], ], ], 'textarea-min' => [ [ - 'type' => 'textarea', - 'required' => false, + 'type' => 'textarea', + 'required' => false, 'min_length' => 25, 'max_length' => null, ], [ - 'valid' => 'This text is long enough to validate', + 'valid' => 'This text is long enough to validate', 'invalid' => 'This is too short', ], ], 'textarea-max' => [ [ - 'type' => 'textarea', - 'required' => false, + 'type' => 'textarea', + 'required' => false, 'min_length' => null, 'max_length' => 25, ], [ - 'valid' => 'This is short enough', + 'valid' => 'This is short enough', 'invalid' => 'This is way too much text to validate', ], ], @@ -198,21 +198,21 @@ public function fields(): array // Email 'email-required' => [ [ - 'type' => 'email', + 'type' => 'email', 'required' => true, ], [ - 'valid' => 'test@example.com', + 'valid' => 'test@example.com', 'invalid' => null, ], ], 'email-optional' => [ [ - 'type' => 'email', + 'type' => 'email', 'required' => false, ], [ - 'valid' => null, + 'valid' => null, 'invalid' => 'not an email', ], ], @@ -220,21 +220,21 @@ public function fields(): array // Url 'url-required' => [ [ - 'type' => 'url', + 'type' => 'url', 'required' => true, ], [ - 'valid' => 'https://example.com', + 'valid' => 'https://example.com', 'invalid' => null, ], ], 'url-optional' => [ [ - 'type' => 'url', + 'type' => 'url', 'required' => false, ], [ - 'valid' => null, + 'valid' => null, 'invalid' => 'not a url', ], ], @@ -242,49 +242,49 @@ public function fields(): array // Number 'number-required' => [ [ - 'type' => 'number', - 'required' => true, + 'type' => 'number', + 'required' => true, 'min_value' => null, 'max_value' => null, ], [ - 'valid' => 17, + 'valid' => 17, 'invalid' => null, ], ], 'number-optional' => [ [ - 'type' => 'number', - 'required' => false, + 'type' => 'number', + 'required' => false, 'min_value' => null, 'max_value' => null, ], [ - 'valid' => null, + 'valid' => null, 'invalid' => 'not a number', ], ], 'number-min' => [ [ - 'type' => 'number', - 'required' => false, + 'type' => 'number', + 'required' => false, 'min_value' => 17, 'max_value' => null, ], [ - 'valid' => 17, + 'valid' => 17, 'invalid' => 5, ], ], 'number-max' => [ [ - 'type' => 'number', - 'required' => false, + 'type' => 'number', + 'required' => false, 'min_value' => null, 'max_value' => 17, ], [ - 'valid' => 17, + 'valid' => 17, 'invalid' => 25, ], ], @@ -292,61 +292,61 @@ public function fields(): array // Date 'date-required' => [ [ - 'type' => 'date', + 'type' => 'date', 'required' => true, 'min_date' => null, 'max_date' => null, ], [ - 'valid' => today(), + 'valid' => today(), 'invalid' => null, ], ], 'date-optional' => [ [ - 'type' => 'date', + 'type' => 'date', 'required' => false, 'min_date' => null, 'max_date' => null, ], [ - 'valid' => null, + 'valid' => null, 'invalid' => 'not a date', ], ], 'date-min' => [ [ - 'type' => 'date', + 'type' => 'date', 'required' => false, 'min_date' => '2020-01-01', 'max_date' => null, ], [ - 'valid' => '2022-01-01', + 'valid' => '2022-01-01', 'invalid' => '1999-01-01', ], ], 'date-max' => [ [ - 'type' => 'date', + 'type' => 'date', 'required' => false, 'min_date' => null, 'max_date' => '2021-12-31', ], [ - 'valid' => '1999-01-01', + 'valid' => '1999-01-01', 'invalid' => '2022-01-01', ], ], 'date-minmax' => [ [ - 'type' => 'date', + 'type' => 'date', 'required' => false, 'min_date' => '2020-01-01', 'max_date' => '2021-12-31', ], [ - 'valid' => '2020-06-01', + 'valid' => '2020-06-01', 'invalid' => '2022-01-01', ], ], @@ -354,9 +354,9 @@ public function fields(): array // Radio 'radio-required' => [ [ - 'type' => 'radio', + 'type' => 'radio', 'required' => true, - 'options' => [ + 'options' => [ 'similique', 'accusantium', 'minima', @@ -364,16 +364,16 @@ public function fields(): array ], ], [ - 'valid' => 'similique', + 'valid' => 'similique', 'invalid' => null, ], ], 'radio-optional' => [ [ - 'type' => 'radio', + 'type' => 'radio', 'required' => false, - 'options' => [ + 'options' => [ 'assumenda', 'excepturi', 'impedit', @@ -381,7 +381,7 @@ public function fields(): array ], ], [ - 'valid' => null, + 'valid' => null, 'invalid' => 'not a valid option', ], ], @@ -389,25 +389,25 @@ public function fields(): array // Checkbox 'checkbox-required' => [ [ - 'type' => 'checkbox', + 'type' => 'checkbox', 'required' => true, - 'options' => [ + 'options' => [ 'architecto', 'quis', 'maiores', ], ], [ - 'valid' => ['quis', 'maiores'], + 'valid' => ['quis', 'maiores'], 'invalid' => null, ], ], 'checkbox-optional' => [ [ - 'type' => 'checkbox', + 'type' => 'checkbox', 'required' => false, - 'options' => [ + 'options' => [ 'dolorem', 'iure', 'animi', @@ -415,7 +415,7 @@ public function fields(): array ], ], [ - 'valid' => ['iure'], + 'valid' => ['iure'], 'invalid' => 'not a valid option', ], ], diff --git a/tests/TestCase.php b/tests/TestCase.php index 5bd2e061..c376f4c8 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -26,13 +26,13 @@ public function boot(): void Language::insert([ [ - 'code' => 'ro', - 'name' => 'Română', + 'code' => 'ro', + 'name' => 'Română', 'enabled' => true, ], [ - 'code' => 'en', - 'name' => 'English', + 'code' => 'en', + 'name' => 'English', 'enabled' => false, ], ]);