Commit 0b08f4d6bed602e9762b870ae7a7378b326ae6e7
Exists in
master
Merge branch 'master' of http://gitlab.nologostudio.ru/alarionov/rekamore-su
Showing 5 changed files Side-by-side Diff
app/Http/Controllers/Admin/AdminController.php
... | ... | @@ -7,6 +7,7 @@ use App\Http\Requests\CompanyRequest; |
7 | 7 | use App\Models\Company; |
8 | 8 | use App\Models\Employer; |
9 | 9 | use App\Models\User; |
10 | +use Carbon\Carbon; | |
10 | 11 | use Illuminate\Http\Request; |
11 | 12 | use Illuminate\Support\Facades\Auth; |
12 | 13 | use Illuminate\Support\Facades\Hash; |
... | ... | @@ -42,6 +43,7 @@ class AdminController extends Controller |
42 | 43 | 'required' => 'Укажите обязательное поле «:attribute»', |
43 | 44 | 'confirmed' => 'Пароли не совпадают', |
44 | 45 | 'email' => 'Введите корректный email', |
46 | + 'unique' => 'Данный email занят уже', | |
45 | 47 | 'min' => [ |
46 | 48 | 'string' => 'Поле «:attribute» должно быть не меньше :min символов', |
47 | 49 | 'file' => 'Файл «:attribute» должен быть не меньше :min Кбайт' |
... | ... | @@ -64,6 +66,9 @@ class AdminController extends Controller |
64 | 66 | 'name' => $request->name, |
65 | 67 | 'email' => $request->email, |
66 | 68 | 'password' => Hash::make($request->password), |
69 | + 'admin' => '1', | |
70 | + 'email_verified_at' => Carbon::now() | |
71 | + | |
67 | 72 | ]); |
68 | 73 | return redirect() |
69 | 74 | ->route('admin.login') |
app/Models/User.php
resources/views/admin/login.blade.php
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | |
18 | 18 | @section('content') |
19 | 19 | <h1 class="mb-4 text-xl font-semibold text-gray-700 dark:text-gray-200"> |
20 | - Авторизация | |
20 | + Авторизация в админке | |
21 | 21 | </h1> |
22 | 22 | |
23 | 23 | <form method="post" action="{{ route('admin.auth') }}"> |
... | ... | @@ -98,4 +98,12 @@ |
98 | 98 | Создание аккаунта |
99 | 99 | </a> |
100 | 100 | </p> |
101 | + <p class="mt-1"> | |
102 | + <a | |
103 | + class="text-sm font-medium text-purple-600 dark:text-purple-400 hover:underline" | |
104 | + href="{{ route('index') }}" | |
105 | + > | |
106 | + Главная страница | |
107 | + </a> | |
108 | + </p> | |
101 | 109 | @endsection |
resources/views/admin/register.blade.php
... | ... | @@ -19,7 +19,7 @@ |
19 | 19 | <h1 |
20 | 20 | class="mb-4 text-xl font-semibold text-gray-700 dark:text-gray-200" |
21 | 21 | > |
22 | - Создание аккаунта | |
22 | + Создание аккаунта администратора | |
23 | 23 | </h1> |
24 | 24 | <form method="POST" action="{{ route('admin.create') }}"> |
25 | 25 | @csrf |
... | ... | @@ -131,9 +131,17 @@ |
131 | 131 | <p class="mt-4"> |
132 | 132 | <a |
133 | 133 | class="text-sm font-medium text-purple-600 dark:text-purple-400 hover:underline" |
134 | - href="./login.html" | |
134 | + href="{{ route('admin.login') }}" | |
135 | 135 | > |
136 | - Already have an account? Login | |
136 | + Авторизация в системе | |
137 | + </a> | |
138 | + </p> | |
139 | + <p class="mt-1"> | |
140 | + <a | |
141 | + class="text-sm font-medium text-purple-600 dark:text-purple-400 hover:underline" | |
142 | + href="{{ route('index') }}" | |
143 | + > | |
144 | + Главная страница | |
137 | 145 | </a> |
138 | 146 | </p> |
139 | 147 | @endsection |
resources/views/layouts/app.blade.php
... | ... | @@ -45,7 +45,11 @@ |
45 | 45 | <li class="nav-item dropdown"> |
46 | 46 | <a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre> |
47 | 47 | {{ Auth::user()->name }} |
48 | - </a> | |
48 | + </a><br> | |
49 | + | |
50 | + @if (Auth::user()->admin) | |
51 | + <a href="{{ route('admin.index') }}">Личный кабинет пользователя</a><br> | |
52 | + @endif | |
49 | 53 | |
50 | 54 | <div class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown"> |
51 | 55 | <a class="dropdown-item" href="{{ route('logout') }}" |