unknown 1 mesiac pred
rodič
commit
f880f00f75

+ 19 - 3
app/Http/Controllers/AdminController.php

@@ -3,11 +3,27 @@
 namespace App\Http\Controllers;
 
 use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+use App\Models\User;
+use App\Models\Application;
 
 class AdminController extends Controller
 {
-    public function index() {}
+    public function index() {
+        $apps = Application::with('user')->get();
+        return view('admin', compact('apps'));
+    }
+
+    public function post($id, Request $request) {
+        $request->validate([
+            'status' => 'required|in:new,continue,end',
+        ]);
+
+        Application::find($id)->update([
+            'status' => $request->status
+        ]);
+
+        return redirect()->back();
+    }
 
-    public function post() {}
-    
 }

+ 53 - 5
app/Http/Controllers/AuthController.php

@@ -3,17 +3,65 @@
 namespace App\Http\Controllers;
 
 use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+use App\Models\User;
+use App\Models\Application;
 
 class AuthController extends Controller
 {
-    public function logout() {}
+    public function logout(Request $request) {
+        Auth::logout();
+        $request->session()->invalidate();
+        $request->session()->regenerateToken();
 
-    public function register() {}
+        return view('home');
+    }
+
+    public function register() {
+        return view('register');
+    }
     
-    public function register_post() {}
+    public function register_post(Request $request) {
+        $request->validate([
+            'login' => 'required|min:6|unique:users|regex:/^[A-Za-z0-9]+$/',
+            'phone' => 'required|regex:/^8\(\d{3}\)\d{3}-\d{2}-\d{2}$/',
+            'fio' => 'required|regex:/^[А-ЯЁа-яё\s]+$/u',
+            'email' => 'required|email|unique:users',
+            'password' => 'required|min:8',
+        ]);
+
+        $user = User::create([
+            'login' => $request->login,
+            'phone' => $request->phone,
+            'fio' => $request->fio,
+            'email' => $request->email,
+            'password' => $request->password,
+        ]);
+
+        Auth::login($user);
+        $request->session()->regenerate();
 
-    public function login() {}
+        return redirect('apps');
+    }
+
+    public function login() {
+        return view('login');
+    }
     
-    public function login_post() {}
+    public function login_post(Request $request) {
+        $credentials = $request->validate([
+            'login' => 'required',
+            'password' => 'required',
+        ]);
+
+        if(Auth::attempt($credentials)) {
+            $request->session()->regenerate();
+            return redirect('apps');
+        }
+
+        return redirect()->back()->withErrors([
+            'login' => 'Логин или пароль неверные!'
+        ]);
+    }
     
 }

+ 37 - 5
app/Http/Controllers/BasicController.php

@@ -4,14 +4,46 @@ namespace App\Http\Controllers;
 
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
-use App\Http\
+use App\Models\User;
+use App\Models\Application;
 
 class BasicController extends Controller
 {
+    public function home() {
+        return view('home');
+    }
     public function apps() {
-        return view('apps');
+        $applications = Application::where('user_id', Auth::user()->id)->get();
+        return view('apps', compact('applications'));
+    }
+    public function apps_review($id, Request $request) {
+        $request->validate([
+            'review' => 'required'
+        ]);
+
+        Application::where('id', $id)->update([
+            'review' => $request->review
+        ]);
+
+        return redirect('apps');
+    }
+    public function apps_create() {
+        return view('apps-create');
+    }
+    public function apps_create_post(Request $request) {
+        $request->validate([
+            'course_name' => 'required|min:5|max:255',
+            'date' => 'required|date',
+            'payment' => 'required|in:cash,transfit',
+        ]);
+
+        Application::create([
+            'user_id' => Auth::user()->id,
+            'course_name' => $request->course_name,
+            'date' => $request->date,
+            'payment' => $request->payment,
+        ]);
+
+        return redirect('apps');
     }
-    public function apps_review() {}
-    public function apps_create() {}
-    public function apps_create_post() {}
 }

+ 1 - 1
database/migrations/2026_04_19_062617_create_applications_table.php

@@ -18,7 +18,7 @@ return new class extends Migration
             $table->date('date');
             $table->enum('payment', ['cash', 'transfit']);
             $table->enum('status', ['new', 'continue', 'end'])->default('new');
-            $table->text('review');
+            $table->text('review')->nullable();
             $table->timestamps();
         });
     }

BIN
public/images/1.webp


BIN
public/images/2.webp


BIN
public/images/3.webp


BIN
public/images/4.webp


BIN
public/images/adv1.webp


BIN
public/images/adv2.webp


BIN
public/images/adv3.webp


BIN
public/images/hero.webp


BIN
public/images/logo.webp


+ 57 - 0
resources/views/admin.blade.php

@@ -0,0 +1,57 @@
+@extends('layout')
+
+@section('content')
+<main class="container mx-auto px-5">
+    <h1 class="text-4xl font-bold text-center my-4">Админ-панель</h1>
+    <article class="overflow-x-scroll">
+        @if($apps->isNotEmpty())
+        <table class="w-full text-center xl:mb-64 lg:mb-48 mb-32">
+            <thead>
+                <tr>
+                    <th class="border border-gray-300">№ заявки</th>
+                    <th class="border border-gray-300">Логин</th>
+                    <th class="border border-gray-300">Почта</th>
+                    <th class="border border-gray-300">Телефон</th>
+                    <th class="border border-gray-300">Название курса</th>
+                    <th class="border border-gray-300">Дата</th>
+                    <th class="border border-gray-300">Способ оплаты</th>
+                    <th class="border border-gray-300">Изменить статус</th>
+                    <th class="border border-gray-300">Отзыв</th>
+                </tr>
+            </thead>
+            <tbody>
+                @foreach($apps as $app)
+                <tr class="">
+                    <td class="border border-gray-300 py-3 px-2">{{ $app->id }}</td>
+                    <td class="border border-gray-300 py-3 px-2">{{ $app->user->login }}</td>
+                    <td class="border border-gray-300 py-3 px-2">{{ $app->user->email }}</td>
+                    <td class="border border-gray-300 py-3 px-2">{{ $app->user->phone }}</td>
+                    <td class="border border-gray-300 py-3 px-2">{{ $app->course_name }}</td>
+                    <td class="border border-gray-300 py-3 px-2">{{ $app->date }}</td>
+                    <td class="border border-gray-300 py-3 px-2">{{ $app->payment }}</td>
+                    <td class="border border-gray-300 py-3 px-2">
+                        @if($app->status != 'end')
+                        <form action="{{ route('admin.post', $app->id) }}" method="POST" class='flex gap-1'>
+                            @csrf
+                            <select name="status" id="" class="p-2 rounded-xl border border-gray-600">
+                                <option value="new" @selected($app->status == 'new')>Новая</option>
+                                <option value="continue" @selected($app->status == 'continue')>Обучение идет</option>
+                                <option value="end">Обучение завершено</option>
+                            </select>
+                            <button class="py-1 px-3 rounded-xl bg-yellow-500 text-white">Изменить</button>
+                        </form>
+                        @else
+                        Обучение завершено
+                        @endif
+                    </td>
+                    <td class="border border-gray-300 py-3 px-2">{{ $app->review }}</td>
+                </tr>
+                @endforeach
+            </tbody>
+        </table>
+        @else
+        <p>Еще никто не поадвал заявку!</p>
+        @endif
+    </article>
+</main>
+@endsection

+ 17 - 0
resources/views/apps-create.blade.php

@@ -0,0 +1,17 @@
+@extends('layout')
+
+@section('content')
+<main class="container mx-auto px-5 flex flex-col items-center">
+    <h1 class="text-4xl font-bold text-center my-4">Создание заявки</h1>
+    <form method="POST" action="{{ route('apps.create.post') }}" class="flex flex-col gap-3 p-12 border border-gray-200 mt-5 rounded-xl shadow-xl">
+        @csrf
+        <input class='py-2 px-4 rounded-xl border border-gray-300' type="text" placeholder="Название курса" name="course_name" value="{{ old('course_name') }}">
+        <input class='py-2 px-4 rounded-xl border border-gray-300' type="date" placeholder="date" name="date" value="{{ old('date') }}">
+        <select class='py-2 px-4 rounded-xl border border-gray-300' name="payment" id="">
+            <option value="cash">Наличными</option>
+            <option value="transfit">Переводом по номеру</option>
+        </select>
+        <button class='py-2 px-3 rounded-xl bg-green-600 text-white font-medium'>Создать</button>
+    </form>
+</main>
+@endsection

+ 51 - 0
resources/views/apps.blade.php

@@ -0,0 +1,51 @@
+@extends('layout')
+
+@section('content')
+<main class="container mx-auto px-5">
+    <h1 class="text-4xl font-bold text-center my-4">Ваши заявки</h1>
+    <article>
+        @if($applications->isNotEmpty())
+        <ul class="grid xl:grid-cols-5 lg:grid-cols-3 md:grid-cols-2 grid-cols-1 gap-6 xl:mb-72 lg:mb-64 md:mb-32">
+            @foreach($applications as $app)
+            <li class="p-5 rounded-xl border-2 border-indigo-800 flex flex-col gap-5">
+                <article class="flex flex-col">
+                    <p class="text-sm text-gray-400">Курс</p>
+                    <p class="text-xl font-medium text-indigo-800">{{ $app->course_name }}</p>
+                </article>
+                <article class="flex flex-col">
+                    <p class="text-sm text-gray-400">Дата</p>
+                    <p class="">{{ $app->date }}</p>
+                </article>
+                <article class="flex flex-col">
+                    <p class="text-sm text-gray-400">Статус заявки</p>
+                    @if($app->status == 'new')
+                    <p class="">Новая</p>
+                    @elseif($app->status == 'continue')
+                    <p class="">Продолжается</p>
+                    @else
+                    <p class="">Закончено</p>
+                    @endif
+                </article>
+                @if($app->status == 'end' && $app->review == '')
+                <form action="{{ route('apps.review', $app->id) }}" method="POST">
+                    @csrf
+                    <textarea class="w-full border border-gray-300 rounded-xl p-3" name="review" id="" placeholder="Напишите отзыв"></textarea>
+                    <button class="py-2 px-2 rounded-xl bg-green-500 text-white font-semibold">Отправить</button>
+                </form>
+                @endif
+                @if($app->review)
+                <article class="flex flex-col">
+                    <p class="text-sm text-gray-400">Ваш отзыв:</p>
+                    <p>"{{ $app->review }}"</p>
+                </article>
+                @endif
+            </li>
+
+            @endforeach
+        </ul>
+        @else
+            <p class='text-center italic md:text-xl text-base xl:mt-48 lg:mt-32 md:mt-24 mt-6 mb-96'>У вас нет никакой заявки на обучение!</p>
+        @endif
+    </article>
+</main>
+@endsection

+ 65 - 0
resources/views/home.blade.php

@@ -0,0 +1,65 @@
+@extends('layout')
+
+@section('content')
+<main class="container mx-auto px-5">
+    <section class="w-full flex xl:flex-row flex-col-reverse xl:justify-between xl:bg-gray-300 relative">
+        <article>
+            <img class='xl:w-auto w-full' src="{{ asset('images/hero.webp') }}" alt="" loading="lazy">
+        </article>
+        <article class='bg-white shadow-lg xl:absolute top-1/4 right-16 flex flex-col xl:gap-12 md:gap-5 gap-12 xl:items-start items-center py-16 px-12'>
+            <article class="flex flex-col xl:items-start items-center gap-3">
+                <h1 class="xl:text-start text-center text-3xl font-bold text-indigo-800">Корочки.есть - самый лучший портал</h1>
+                <p class="text-xl xl:text-start text-center">- Для получения знаний!</p>
+            </article>
+            <a href="{{ route('apps') }}" class='bg-green-600 py-2 px-4 md:text-base text-xl rounded-xl text-white font-medium xl:self-end self-center'>Подать заявку</a>
+        </article>
+    </section>
+    <section class="flex flex-col items-center">
+        <h2 class="text-2xl font-bold text-indigo-800 my-12">Наши преимущества:</h2>
+        <ul class="flex lg:flex-row flex-col lg:gap-16 gap-10">
+            <li class="flex flex-col items-center gap-1 ">
+                <img src="{{ asset('images/adv1.webp') }}" alt="adventage1" loading="lazy" class='md:w-32 w-28'>
+                <p class='text-xl italic w-48 text-center'>Первые на рынке по предоставлению знаний</p>
+            </li>
+            <li class="flex flex-col items-center gap-1 ">
+                <img src="{{ asset('images/adv2.webp') }}" alt="adventage2" loading="lazy" class='md:w-32 w-28'>
+                <p class='text-xl italic w-48 text-center'>Отличные преподаватели</p>
+            </li>
+            <li class="flex flex-col items-center gap-1 ">
+                <img src="{{ asset('images/adv3.webp') }}" alt="adventage3" loading="lazy" class='md:w-32 w-28'>
+                <p class='text-xl italic w-48 text-center'>Цена/качество за обучение</p>
+            </li>
+        </ul>
+    </section>
+    <section class='flex flex-col items-center gap-1'>
+        <h3 class="text-2xl font-bold text-indigo-800 mt-12 mb-4">Наши аудитории:</h3>
+        <article class="relative overflow-hidden xl:w-1/2 md:w-2/3 w-full">
+            <article class='flex duration-500' id="carousel">
+                <img src="{{ asset('images/1.webp') }}" alt="carousel_item1" loading="lazy" class='w-full flex-shrink-0 '>
+                <img src="{{ asset('images/2.webp') }}" alt="carousel_item2" loading="lazy" class='w-full flex-shrink-0 '>
+                <img src="{{ asset('images/3.webp') }}" alt="carousel_item3" loading="lazy" class='w-full flex-shrink-0 '>
+                <img src="{{ asset('images/4.webp') }}" alt="carousel_item4" loading="lazy" class='w-full flex-shrink-0 '>
+            </article>
+            <button class='w-14 h-14 font-bold bg-gray-800 text-white rounded-full absolute top-1/2 right-0' onclick="next()">></button>
+            <button class='w-14 h-14 font-bold bg-gray-800 text-white rounded-full absolute top-1/2 ' onclick="prev()"><</button>
+        </article>
+    </section>
+    <script>
+        let index = 1
+        function prev() {
+            index = (index + 3) % 4
+            carouselAction()
+        }
+        function next() {
+            index = (index + 1) % 4
+            carouselAction()
+        }
+        function carouselAction() {
+            document.getElementById('carousel').style.transform = `translateX(-${index * 100}%)`
+        }
+        setInterval(() => {
+            next()
+        }, 3000);
+    </script>
+</main>
+@endsection

+ 71 - 18
resources/views/layout.blade.php

@@ -6,26 +6,79 @@
     <link rel="stylesheet" href="{{ asset('css/tailwind.min.css') }}">
     <title>Корочки.есть</title>
 </head>
-<body>
-    <header class="bg-indigo-800 text-white flex justify-betwen py-3 px-5">
-        <a href="{{ route('home') }}">Лого</a>
-        <nav>
-            <a href="{{ route('apps') }}">Заявки</a>
-            <a href="{{ route('apps.create') }}">Создать заявку</a>
-        </nav>
-        @guest
-        <article>
-            <a href="{{ route('register') }}">Создать аккаунт</a>
-            <a href="{{ route('login') }}">Войти</a>
+<body class=''>
+    <header class="bg-indigo-800 text-white px-5">
+        <article class='lg:flex hidden items-center flex-row justify-between py-3 px-5'>
+            <a href="{{ route('home') }}">
+                <img src="{{ asset('images/logo.webp') }}" alt="logo" loading="lazy" class="w-10">
+            </a>
+            <nav class="flex flex-row items-center gap-5">
+                <a href="{{ route('apps') }}">Заявки</a>
+                <a href="{{ route('apps.create') }}">Создать заявку</a>
+                @if(Auth::check() && Auth::user()->login == 'Admin')
+                <a href="{{ route('admin') }}">Админ-панель</a>
+                @endif
+            </nav>
+            @guest
+            <article class="flex flex-row items-center gap-5">
+                <a href="{{ route('register') }}">Создать аккаунт</a>
+                <a href="{{ route('login') }}">Войти</a>
+            </article>
+            @endguest
+            @auth
+            <a href="{{ route('logout') }}" class='hidden md:block'>Выйти</a>
+            @endauth
         </article>
-        @endguest
-        @auth
-        <a href="{{ route('logout') }}">Выйти</a>
-        @endauth
-        @if(Auth::check() && Auth::user()->login == 'Admin')
-        <a href="{{ route('admin') }}">Админ-панель</a>
-        @endif
+        <button class='font-black text-white lg:hodden block absolute top-3 right-8' onclick='headerswap()'>=</button>
+        <article class='lg:hidden flex items-start flex-col py-3 px-5 gap-3' >
+            <a href="{{ route('home') }}">
+                <img src="{{ asset('images/logo.webp') }}" alt="logo" loading="lazy" class="w-10">
+            </a>
+            <article class='flex flex-col hidden' id='header_under'>
+                <nav class="flex flex-col gap-3">
+                    <a href="{{ route('apps') }}">Заявки</a>
+                    <a href="{{ route('apps.create') }}">Создать заявку</a>
+                    @if(Auth::check() && Auth::user()->login == 'Admin')
+                    <a href="{{ route('admin') }}">Админ-панель</a>
+                    @endif
+                </nav>
+                @guest
+                <article class="flex flex-col gap-3">
+                    <a href="{{ route('register') }}">Создать аккаунт</a>
+                    <a href="{{ route('login') }}">Войти</a>
+                </article>
+                @endguest
+                @auth
+                <a href="{{ route('logout') }}">Выйти</a>
+                @endauth
+            </article>
+        </article>
+        
     </header>
+    <script>
+        function headerswap() {
+            document.getElementById('header_under').classList.toggle('hidden')
+        }
+    </script>
     @yield('content')
+    <footer class=' text-white font-light text-center mt-40'>
+        <article class='bg-indigo-800 text-light flex flex-row justify-around py-20'>
+            <ul class='flex flex-col gap-1'>
+                <li class='font-bold'>Навигация по сайту</li>
+                <li><a href="{{ route('home') }}">Главная</a></li>
+                <li><a href="{{ route('apps') }}">Заявки</a></li>
+                <li><a href="{{ route('apps.create') }}">Создать заявку</a></li>
+            </ul>
+            <ul class='flex flex-col gap-1'>
+                <li class='font-bold'>Спонсоры</li>
+                <li><a href="https://online.sberbank.ru/CSAFront/index.do">СБЕР</a></li>
+                <li><a href="https://www.tbank.ru/">ТБАНК</a></li>
+                <li><a href="https://skysmart.ru/">SkySmart</a></li>
+            </ul>
+        </article>
+            <p class='bg-indigo-900 py-4'>
+                @2026 - "Корочки.есть"
+            </p>
+    </footer>
 </body>
 </html>

+ 14 - 0
resources/views/login.blade.php

@@ -0,0 +1,14 @@
+@extends('layout')
+
+@section('content')
+<main class="container mx-auto px-5 flex flex-col gap-4 items-center">
+    <h1 class="text-4xl font-bold text-center my-4">Авторизация</h1>
+    <form method="POST" action="{{ route('login.post') }}" class="flex flex-col items-center gap-3 p-12 border border-gray-200 mt-5 rounded-xl shadow-xl">
+        @csrf
+        <input class='py-2 px-4 rounded-xl border border-gray-300' type="text" placeholder="login" name="login" value="{{ old('login') }}">
+        <input class='py-2 px-4 rounded-xl border border-gray-300' type="password" placeholder="password" name="password" value="{{ old('password') }}">
+        <button class='py-2 px-3 rounded-xl bg-green-600 text-white px-5 font-medium my-2'>Войти</button>
+        <a href="{{ route('register') }}" class='font-light'>Ещё не зарегистрировались? Создать аккаунт</a>
+    </form>
+</main>
+@endsection

+ 17 - 0
resources/views/register.blade.php

@@ -0,0 +1,17 @@
+@extends('layout')
+
+@section('content')
+<main class="container mx-auto px-5 flex flex-col gap-4 items-center">
+    <h1 class="text-4xl font-bold text-center my-4">Регистрация</h1>
+    <form method="POST" action="{{ route('register.post') }}"class="flex flex-col items-center gap-3 p-12 border border-gray-200 mt-5 rounded-xl shadow-xl">
+        @csrf
+        <input class='py-2 px-4 rounded-xl border border-gray-300' type="text" placeholder="login" name="login" value="{{ old('login') }}">
+        <input class='py-2 px-4 rounded-xl border border-gray-300' type="text" placeholder="ФИО" name="fio" value="{{ old('fio') }}">
+        <input class='py-2 px-4 rounded-xl border border-gray-300' type="phone" placeholder="8(XXX)XXX-XX-XX" name="phone" value="{{ old('phone') }}">
+        <input class='py-2 px-4 rounded-xl border border-gray-300' type="email" placeholder="email" name="email" value="{{ old('email') }}">
+        <input class='py-2 px-4 rounded-xl border border-gray-300' type="password" placeholder="password" name="password" value="{{ old('password') }}">
+        <button class='py-2 px-3 rounded-xl bg-green-600 text-white font-medium my-2'>Создать пользователя</button>
+        <a href="{{ route('login') }}" class='font-light'>Уже зарегистрировались? Войти</a>
+    </form>
+</main>
+@endsection

+ 1 - 1
routes/web.php

@@ -5,7 +5,7 @@ use App\Http\Controllers\AdminController;
 use App\Http\Controllers\BasicController;
 use App\Http\Controllers\AuthController;
 
-Route::get('/home', )->name('home');
+Route::get('/', [BasicController::class, 'home'])->name('home');
 
 Route::middleware('auth')->group(function() {
     Route::get('/apps', [BasicController::class, 'apps'])->name('apps');