Skip to content

Commit

Permalink
Laravel 11 Structure Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
KaniRobinson committed Jul 13, 2024
1 parent 869df71 commit b9b2471
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 99 deletions.
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"license": "MIT",
"authors": [],
"require": {
"php": "^8.1",
"spatie/laravel-package-tools": "^1.16",
"php": "^8.2",
"illuminate/contracts": "^10.0||^11.0"
},
"require-dev": {
Expand Down
7 changes: 3 additions & 4 deletions config/installation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

return [
'settings' => [
1 => ['theme', 'hotel_name', 'rcon_ip', 'rcon_port', 'avatar_imager', 'discord_invitation_link', 'discord_widget_id'],
1 => ['theme', 'hotel_name', 'rcon_ip', 'rcon_port', 'discord_invitation_link', 'discord_widget_id'],
2 => ['start_motto', 'start_credits', 'start_duckets', 'start_diamonds', 'start_points', 'start_look', 'max_accounts_per_ip'],
3 => ['referrals_needed', 'referral_reward_amount', 'min_staff_rank', 'maintenance_message', 'requires_beta_code', 'disable_registration', 'cms_color_mode'],
4 => ['give_hc_on_register', 'hc_on_register_duration', 'max_comment_per_article', 'website_wordfilter_enabled', 'vpn_block_enabled', 'ipdata_api_key', 'housekeeping_url'],
5 => [],
3 => ['min_staff_rank', 'disable_registration', 'cms_color_mode', 'give_hc_on_register', 'hc_on_register_duration'],
4 => [],
],
];
Empty file added database/factories/.gitkeep
Empty file.
19 changes: 0 additions & 19 deletions database/factories/ModelFactory.php

This file was deleted.

20 changes: 0 additions & 20 deletions database/migrations/create_website_installation_table.php.stub

This file was deleted.

24 changes: 24 additions & 0 deletions resources/lang/gb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"title": "Welcome to Atom CMS",
"subtitle": "We are delighted of having you trying Atom CMS",
"installation_key": "Installation Key",
"installation_key.start_button": "Start the setup",
"installation_key.placeholder": "Enter your installation key",
"installation_key.message_1": "Hello there! We are truly grateful that you have chosen Atom CMS for your hotel.",
"installation_key.message_2": "Atom CMS is built with the community in mind, meaning we highly value community input, rather than only bringing our own ideas & vision to the CMS we try our very best to implement suggestions made by our beloved community. We want everyone to be able to contribute or customise Atom CMS to their needs without having a bachelor in programming.",
"installation_key.message_3": "Atom CMS sole purpose is to empower hotel owners like you. We want you to be able to run your hotel with ease. Our user-friendly interface, robust features, and helpful community are here to ensure that your experience with Atom CMS is nothing short of exceptional!",
"installation_key.message_4": "As you dive into Atom CMS, we encourage you to explore the extensive range of features we have curated to help you bring your vision to life. From customizable templates to seamless integrations with clients like Nitro, we will have you set up in no time.",
"installation_key.message_5": "To get started, we recommend checking out our <a href=\":documentation_link\" target=\"_blank\" class=\"font-semibold underline\">comprehensive documentation</a>, which will guide you through the initial setup and help you make the most of your Atom CMS experience.",
"installation_key.message_6": "And remember, please <a href=\":discord_link\" target=\"_blank\" class=\"font-semibold underline\">join our Discord</a>. If you have any questions or need assistance, please do not hesitate to reach out. We are here to help you every step of the way.",
"installation_key.message_7": "Once again, thank you for choosing Atom CMS, and we cannot wait to see the incredible project you will create.",
"installation_key.message_8": "With everything being said we just want to wish you a warm welcome to the Atom CMS family!",
"installation_key.message_9": "To avoid any third-party party abuse, please provide the installation code, which can be found in your database inside the \"website_installation\" table under the column \"installation_key\".",
"step.complete_button": "Take me to :hotel",
"step.restart_button": "Restart installation",
"step.continue_button": "Continue to Step :step",
"step.message_1": "Congratulations on successfully completing the Atom CMS setup! You have now taken the first steps towards an exciting new journey. With Atom CMS, you can effortlessly manage various aspect of your hotel, while giving your new visitors an easy gateway into a world of joy.",
"step.message_2": "You can at any time change the settings you went through. All it takes is for you to hop into your database and find the \"website_settings\" table and then tweak the settings you wish. Who knows... As you explore the features and functionalities of Atom CMS, you might discover features that will improve you and your users experience & helping you achieve your online goals!",
"step.message_3": "We also have written a throughout documentation, explaining tons of things regarding managing Atom CMS & other aspect of your hotel. You can visit our <a href=\":documentation_link\" target=\"_blank\" class=\"font-semibold underline\">comprehensive documentation right here</a>. Our goal is to keep expanding our coverage, so keep checking it from time to time.",
"step.message_4": "Lastly, we just want to show our gratitude by letting your know how delighted we are to be a part of your journey and we hope you will gain some amazing memories. So, here is to your new hotel, the boundless creativity it will inspire, and the endless possibilities that lie ahead.",
"step.message_5": "Once again, congratulations and best of wishes for you & your hotel!"
}
23 changes: 0 additions & 23 deletions resources/views/components/layouts/default.blade.php

This file was deleted.

8 changes: 4 additions & 4 deletions resources/views/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<x-installation::layouts.default>
<x-installation-layout>
<x-installation::card icon="hotel-icon" title="{{ __('title') }}" subtitle="{{ __('subtitle') }}">
<div class="space-y-3">
<p>{{ __('installation_key.message_1') }}</p>
Expand All @@ -8,8 +8,8 @@
<p>{!! __('installation_key.message_5', ['documentation_link' => 'https://retros.guide']) !!}</p>
<p>{!! __('installation_key.message_6', ['discord_link' => 'https://discord.gg/rX3aShUHdg']) !!}</p>
<p>{{ __('installation_key.message_7') }}</p>
<p class="font-semibold italic">{{ __('installation_key.message_8') }}</p>
<p class="border-t py-3">{{ __('installation_key.message_9') }}</p>
<p class="italic font-semibold">{{ __('installation_key.message_8') }}</p>
<p class="py-3 border-t">{{ __('installation_key.message_9') }}</p>

<form action="{{ route('installation.store') }}" method="POST">
@csrf
Expand All @@ -24,4 +24,4 @@
</form>
</div>
</x-installation::card>
</x-installation::layouts.default>
</x-installation-layout>
21 changes: 14 additions & 7 deletions resources/views/step.blade.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
<x-installation::layouts.default>
<x-installation-layout>
<x-installation::card icon="hotel-icon" title="{{ __('title') }}" subtitle="{{ __('subtitle') }}">

<form action="{{ route('installation.update', ['installation' => $step]) }}" method="POST" class="space-y-3">
@method('PUT')

@csrf

@forelse ($settings as $setting)
<x-installation::input id="{{ $setting->key }}" name="{{ $setting->key }}"
label="{{ Str::replace('_', ' ', Str::ucfirst($setting->key)) }}" value="{{ $setting->value }}"
type="text" placeholder="{{ $setting->key }}" autocomplete="false" required />
@forelse ($fields as $field)
<x-installation::input
id="{{ $field }}"
name="{{ $field }}"
placeholder="{{ $field }}"
value="{{ $settings->firstWhere('key', $field)?->value }}"
label="{{ Str::replace('_', ' ', Str::ucfirst($field)) }}"
type="text"
autocomplete="false"
required
/>
@empty
<div class="space-y-3">
<p>{{ __('step.message_1') }}</p>
<p>{{ __('step.message_2') }}</p>
<p>{!! __('step.message_3', ['documentation_link' => 'https://retros.guide']) !!}</p>
<p>{{ __('step.message_4') }}</p>
<p class="font-semibold italic">{{ __('step.message_5') }}</p>
<p class="italic font-semibold">{{ __('step.message_5') }}</p>
</div>
@endforelse

Expand Down Expand Up @@ -44,4 +51,4 @@ class="w-full mt-3">
</form>
</div>
</x-installation::card>
</x-installation::layouts.default>
</x-installation-layout>
10 changes: 5 additions & 5 deletions src/Http/Controllers/InstallationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ public function show(int $installation): View
{
$name = WebsiteSetting::firstWhere('key', 'hotel_name');

$step = $installation;

$fields = Arr::get(config('installation.settings', []), $installation, []);

$settings = WebsiteSetting::whereIn('key', Arr::get(config('installation.settings', []), $installation, []))
->get();

return view('installation::step', [
'name' => $name,
'step' => $installation,
'settings' => $settings,
]);
return view('installation::step', compact('name', 'step', 'fields', 'settings'));
}

/**
Expand Down
40 changes: 25 additions & 15 deletions src/InstallationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,37 @@

namespace Atom\Installation;

use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;
use Illuminate\Support\ServiceProvider;

class InstallationServiceProvider extends PackageServiceProvider
class InstallationServiceProvider extends ServiceProvider
{
/**
* Configure the package.
* Register any application services.
*
* @return void
*/
public function configurePackage(Package $package): void
public function register()
{
$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
$this->mergeConfigFrom(
path: __DIR__.'/../config/installation.php',
key: 'installation'
);

$this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'installation');
$this->loadMigrationsFrom(
paths: __DIR__.'/../database/migrations'
);

$package
->name('installation')
->hasConfigFile()
->hasRoute('web')
->hasViews()
->hasTranslations()
->hasMigrations(['create_website_installation_table'])
->runsMigrations();
$this->loadJsonTranslationsFrom(
path: __DIR__.'/../resources/lang'
);

$this->loadViewsFrom(
path: __DIR__.'/../resources/views',
namespace: 'installation',
);

$this->loadRoutesFrom(
path: __DIR__.'/../routes/web.php'
);
}
}

0 comments on commit b9b2471

Please sign in to comment.