diff --git a/app/Http/Controllers/CollectiveController.php b/app/Http/Controllers/CollectiveController.php new file mode 100644 index 0000000..47c241a --- /dev/null +++ b/app/Http/Controllers/CollectiveController.php @@ -0,0 +1,54 @@ +safe()->only([ + 'title', + 'name', + 'email', + 'password', + ]); + + $collective = Collective::store($validated); + auth()->login($collective); + return redirect()->route('dashboard')->with('success', 'Fanatic installed!'); + } + + public function show(Collective $collective) + { + // + } + + public function edit(Collective $collective) + { + // + } + + public function update(UpdateCollectiveRequest $request, Collective $collective) + { + // + } + + public function destroy(Collective $collective) + { + // + } +} diff --git a/app/Http/Requests/StoreCollectiveRequest.php b/app/Http/Requests/StoreCollectiveRequest.php new file mode 100644 index 0000000..5bc3f9d --- /dev/null +++ b/app/Http/Requests/StoreCollectiveRequest.php @@ -0,0 +1,25 @@ + ['required', 'string', 'max:255'], + 'name' => ['required', 'string', 'max:255'], + 'email' => ['required', 'email', 'max:100'], + 'password' => ['required', 'confirmed', Password::min(6)->letters()->numbers()], + ]; + } +} diff --git a/app/Http/Requests/UpdateCollectiveRequest.php b/app/Http/Requests/UpdateCollectiveRequest.php new file mode 100644 index 0000000..aa1b550 --- /dev/null +++ b/app/Http/Requests/UpdateCollectiveRequest.php @@ -0,0 +1,30 @@ + 'datetime', ]; + +/* -------------------------------------------------------------------------------- password ---- */ + + protected function password() : Attribute + { + return Attribute::make( + set: fn ($value) => bcrypt($value), + ); + } + +/* ----------------------------------------------------------------------------------- store ---- */ + + public static function store(array $validated) : Collective + { + $collective = new Collective(); + $collective->title = $validated['title']; + $collective->name = $validated['name']; + $collective->email = $validated['email']; + $collective->password = $validated['password']; + $collective->save(); + + return $collective; + } } diff --git a/config/auth.php b/config/auth.php index d8c6cee..d36460c 100644 --- a/config/auth.php +++ b/config/auth.php @@ -62,7 +62,7 @@ 'providers' => [ 'users' => [ 'driver' => 'eloquent', - 'model' => App\Models\User::class, + 'model' => App\Models\Collective::class, ], // 'users' => [ diff --git a/public/css/admin/style.css b/public/css/admin/style.css index d94fb1b..76573b1 100644 --- a/public/css/admin/style.css +++ b/public/css/admin/style.css @@ -92,6 +92,10 @@ .form__btns:first-of-type { margin-top: 20px; } +.form__error { + color: #e20000; +} + html, body { width: 100%; height: 100%; @@ -109,7 +113,6 @@ .l-container { margin: 0 auto; background-color: #f8f8ff; border: 1px solid #7874ff; - padding: 0 40px; } .l-nav { @@ -133,5 +136,13 @@ .l-nav__tab:last-child { } .l-main { - padding: 5px; + padding: 10px 40px; +} + +.error { + background-color: #87ff5f; + border: 1px solid #30be00; + padding: 10px; + width: 60%; + margin: 10px auto; } diff --git a/resources/sass/admin/_base.scss b/resources/sass/admin/_base.scss index 19f492f..4cbba31 100644 --- a/resources/sass/admin/_base.scss +++ b/resources/sass/admin/_base.scss @@ -68,4 +68,8 @@ h1 { .form__btn { @extend %btn; +} + +.form__error { + color: $c-red; } \ No newline at end of file diff --git a/resources/sass/admin/_layout.scss b/resources/sass/admin/_layout.scss index 0a1d80d..fbccd5f 100644 --- a/resources/sass/admin/_layout.scss +++ b/resources/sass/admin/_layout.scss @@ -18,7 +18,6 @@ body { margin: 0 auto; background-color: #f8f8ff; border: 1px solid $c-main; - padding: 0 40px; } @@ -44,5 +43,5 @@ body { .l-main { - padding: 5px; + padding: 10px 40px; } \ No newline at end of file diff --git a/resources/sass/admin/_modules.scss b/resources/sass/admin/_modules.scss new file mode 100644 index 0000000..0ac3df9 --- /dev/null +++ b/resources/sass/admin/_modules.scss @@ -0,0 +1,11 @@ +@use 'vars' as *; +@use 'sass:color'; + +.error { + background-color: color.scale($c-green, $lightness: 50%); + border: 1px solid $c-green; + + padding: 10px; + width: 60%; + margin: 10px auto; +} \ No newline at end of file diff --git a/resources/sass/admin/_states.scss b/resources/sass/admin/_states.scss new file mode 100644 index 0000000..6aedf29 --- /dev/null +++ b/resources/sass/admin/_states.scss @@ -0,0 +1,2 @@ +@use 'vars' as *; + diff --git a/resources/sass/admin/_vars.scss b/resources/sass/admin/_vars.scss index 16b4b47..f56d83c 100644 --- a/resources/sass/admin/_vars.scss +++ b/resources/sass/admin/_vars.scss @@ -13,6 +13,10 @@ $c-accent: #de7cff; $c-accent-light: color.scale($c-accent, $lightness: 40%); $c-accent-lightest: color.scale($c-accent, $lightness: 80%); +$c-green: #30be00; +$c-yellow: #ebb000; +$c-red: #e20000; + /* ------------------------------------------------------------------------------------ &BTN ---- */ @mixin hover($focus: false) { diff --git a/resources/sass/admin/style.scss b/resources/sass/admin/style.scss index cc35dc5..b076946 100644 --- a/resources/sass/admin/style.scss +++ b/resources/sass/admin/style.scss @@ -1,2 +1,4 @@ @use 'base'; -@use 'layout'; \ No newline at end of file +@use 'layout'; +@use 'modules'; +@use 'states'; \ No newline at end of file diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php new file mode 100644 index 0000000..1eacd88 --- /dev/null +++ b/resources/views/admin/dashboard.blade.php @@ -0,0 +1,5 @@ +@extends('admin.layout') + +@section('content') +

Dashboard

+@endsection \ No newline at end of file diff --git a/resources/views/admin/install.blade.php b/resources/views/admin/install.blade.php index 3ac7485..a0e5292 100644 --- a/resources/views/admin/install.blade.php +++ b/resources/views/admin/install.blade.php @@ -5,25 +5,33 @@

This is the installation page. You will only need to complete this once, but values can be changed after installation.

-
+ @csrf
- + @error('title')

{{ $message }}

@enderror - + @error('name')

{{ $message }}

@enderror - + @error('email')

{{ $message }}

@enderror - + + @error('password')

{{ $message }}

@enderror + + + + @error('password_confirmation')

{{ $message }}

@enderror
diff --git a/resources/views/admin/layout.blade.php b/resources/views/admin/layout.blade.php index 641fbe3..c0c9ff5 100644 --- a/resources/views/admin/layout.blade.php +++ b/resources/views/admin/layout.blade.php @@ -22,6 +22,20 @@ @endauth
+ @yield('title') + + @if (session()->has('success')) +

{{ session()->get('success') }}

+ @endif + + @if (session()->has('error')) +

{{ session()->get('error') }}

+ @endif + + @if (session()->has('warning')) +

{{ session()->get('warning') }}

+ @endif + @yield('content')
diff --git a/routes/web.php b/routes/web.php index f56f024..fb3443c 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,6 @@ name('dashboard'); +Route::get('/fanatic/install', [CollectiveController::class, 'create'])->name('collectives.create'); +Route::post('/fanatic', [CollectiveController::class, 'store'])->name('collectives.store');