diff --git a/.gitignore b/.gitignore
index b58a40b..9b5e88a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
/public/build
/public/hot
/public/storage
+/public/robots.txt
/storage/*.key
/vendor
.env
diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php
index 7679585..78eb322 100644
--- a/app/Http/Controllers/Auth/RegisterController.php
+++ b/app/Http/Controllers/Auth/RegisterController.php
@@ -22,12 +22,16 @@ public function store(Request $request)
$validated = $request->validate([
'username' => ['required', 'string', 'unique:users'],
'email' => ['required', 'string', 'email', 'unique:users'],
- 'password' => ['required', 'confirmed', 'min:8']
+ 'password' => ['required', 'confirmed', 'min:8'],
+ 'check-bot' => ['nullable'],
]);
+ if($validated['check-bot']) {
+ return redirect(RouteServiceProvider::HOME);
+ }
$user = User::create([
- 'username' => $request->username,
- 'email' => $request->email,
+ 'username' => $validated['username'],
+ 'email' => $validated['email'],
'password' => Hash::make($request->password)
]);
diff --git a/app/Listeners/UpdateLastLogin.php b/app/Listeners/UpdateLastLogin.php
new file mode 100644
index 0000000..3d917ed
--- /dev/null
+++ b/app/Listeners/UpdateLastLogin.php
@@ -0,0 +1,27 @@
+user->last_login = Carbon::now();
+ $event->user->save();
+ }
+}
diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php
index 2d65aac..aeb6ed3 100644
--- a/app/Providers/EventServiceProvider.php
+++ b/app/Providers/EventServiceProvider.php
@@ -18,6 +18,11 @@ class EventServiceProvider extends ServiceProvider
Registered::class => [
SendEmailVerificationNotification::class,
],
+
+ //Event For Login Details Data
+ 'Illuminate\Auth\Events\Login' => [
+ 'App\Listeners\UpdateLastLogin',
+ ],
];
/**
diff --git a/database/migrations/2024_01_27_090123_add_column_last_login_to_users_table.php b/database/migrations/2024_01_27_090123_add_column_last_login_to_users_table.php
new file mode 100644
index 0000000..0f0e20d
--- /dev/null
+++ b/database/migrations/2024_01_27_090123_add_column_last_login_to_users_table.php
@@ -0,0 +1,28 @@
+timestamp('last_login')->nullable();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('users', function (Blueprint $table) {
+ $table->dropColumn('last_login');
+ });
+ }
+};
diff --git a/public/robots.txt b/public/robots.txt
deleted file mode 100644
index eb05362..0000000
--- a/public/robots.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-User-agent: *
-Disallow:
diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php
index 463ea16..5581969 100644
--- a/resources/views/auth/login.blade.php
+++ b/resources/views/auth/login.blade.php
@@ -56,7 +56,9 @@
Сбросить пароль?
- Зарегистрировать аккаунт
+ @if(env('APP_ENV') === 'prod')
+ Зарегистрировать аккаунт
+ @endif
@endsection
diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php
index 1506e93..b9183c0 100644
--- a/resources/views/auth/register.blade.php
+++ b/resources/views/auth/register.blade.php
@@ -63,6 +63,13 @@
+
У меня есть аккаунт
diff --git a/resources/views/components/users/list-table.blade.php b/resources/views/components/users/list-table.blade.php
index c4c0b91..abce3f3 100644
--- a/resources/views/components/users/list-table.blade.php
+++ b/resources/views/components/users/list-table.blade.php
@@ -9,6 +9,12 @@