From ca157ace774d6e7df35a74e8c01600a0507ce1bb Mon Sep 17 00:00:00 2001 From: vasya Date: Sun, 15 Mar 2026 17:21:21 +0300 Subject: [PATCH] =?UTF-8?q?=D0=AF=20=D1=81=D0=BD=D0=B0=D1=87=D0=B0=D0=BB?= =?UTF-8?q?=D0=B0=20=D0=BD=D0=B5=20=D1=85=D0=BE=D1=82=D0=B5=D0=BB=20=D0=B8?= =?UTF-8?q?=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D1=8C=20User=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=20=D0=B0=D1=83=D1=82=D0=B5=D0=BD=D1=82=D0=B8=D1=84?= =?UTF-8?q?=D0=B8=D0=BA=D0=B0=D0=B8=D0=B8,=20=D0=BD=D0=BE=20=D0=B2=20?= =?UTF-8?q?=D0=B8=D1=82=D0=BE=D0=B3=D0=B5=20=D0=BE=D0=BD=D0=B0=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BD=D0=B0=D0=B4=D0=BE=D0=B1=D0=B8=D0=BB=D0=B0=D1=81?= =?UTF-8?q?=D1=8C,=20=D1=82=D0=BE=20=D0=BB=D0=B8=20=D1=8D=D1=82=D0=BE=20?= =?UTF-8?q?=D1=81=D0=B2=D1=8F=D0=B7=D0=B0=D0=BD=D0=BE=20=D1=81=20Sanctum,?= =?UTF-8?q?=20=D1=8F=20=D0=BD=D0=B5=20=D0=BF=D0=BE=D0=BC=D0=BD=D1=8E.=20?= =?UTF-8?q?=D0=A2=D0=BE=D1=87=D0=BD=D0=BE=20=D1=82=D0=BE,=20=D1=87=D1=82?= =?UTF-8?q?=D0=BE=20=D1=8F=20=D0=B5=D0=B5=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D1=8C=D0=B7=D1=83=D1=8E=20=D0=BF=D1=80=D0=B8=20=D0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A=D0=B0=D1=86=D0=B8=D0=B8.?= =?UTF-8?q?=20=D0=AD=D1=82=D0=BE=20=D0=BF=D0=BE=D0=B7=D0=B2=D0=BE=D0=BB?= =?UTF-8?q?=D1=8F=D0=B5=D1=82=20=D0=BD=D0=B5=20=D0=B7=D0=B0=D0=BC=D0=BE?= =?UTF-8?q?=D1=80=D0=B0=D1=87=D0=B8=D0=B2=D0=B0=D1=82=D1=8C=D1=81=D1=8F=20?= =?UTF-8?q?=D1=81=20=D1=85=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC?= =?UTF-8?q?=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BD=D0=B0=20=D0=B2=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BB=D0=B5=20=D1=81=20JSON=20=D1=81=D0=BE=20=D0=B2=D1=81?= =?UTF-8?q?=D0=B5=D0=BC=D0=B8=20=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=D0=BC=D0=B8,=20=D1=87=D1=82=D0=BE=20=D1=83=D0=B4?= =?UTF-8?q?=D0=BE=D0=B1=D0=BD=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/User.php | 42 ++++++++++--------- database/tables_for_magic2.0/users.sql | 15 +++++++ .../users_202602271736.sql | 3 ++ 3 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 database/tables_for_magic2.0/users.sql create mode 100644 database/tables_for_magic2.0/users_202602271736.sql diff --git a/app/Models/User.php b/app/Models/User.php index 749c7b7..a967f84 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -6,43 +6,45 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; +use Laravel\Sanctum\HasApiTokens; class User extends Authenticatable { - /** @use HasFactory<\Database\Factories\UserFactory> */ - use HasFactory, Notifiable; + use HasApiTokens, HasFactory, Notifiable; /** * The attributes that are mass assignable. * - * @var list + * @var array */ + // protected $fillable = [ + // 'name', + // 'email', + // 'password', + // ]; protected $fillable = [ - 'name', - 'email', - 'password', + 'login', ]; + /** * The attributes that should be hidden for serialization. * - * @var list + * @var array */ - protected $hidden = [ - 'password', - 'remember_token', - ]; + // protected $hidden = [ + // 'password', + // 'remember_token', + // ]; + protected $hidden = []; /** - * Get the attributes that should be cast. + * The attributes that should be cast. * - * @return array + * @var array */ - protected function casts(): array - { - return [ - 'email_verified_at' => 'datetime', - 'password' => 'hashed', - ]; - } + protected $casts = [ + 'email_verified_at' => 'datetime', + 'password' => 'hashed', + ]; } diff --git a/database/tables_for_magic2.0/users.sql b/database/tables_for_magic2.0/users.sql new file mode 100644 index 0000000..e32cdb9 --- /dev/null +++ b/database/tables_for_magic2.0/users.sql @@ -0,0 +1,15 @@ +-- custom.users definition + +CREATE TABLE `users` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `login` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Логин пользователя', + `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `email_verified_at` timestamp NULL DEFAULT NULL, + `password` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `users_email_unique` (`email`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; \ No newline at end of file diff --git a/database/tables_for_magic2.0/users_202602271736.sql b/database/tables_for_magic2.0/users_202602271736.sql new file mode 100644 index 0000000..0e9954a --- /dev/null +++ b/database/tables_for_magic2.0/users_202602271736.sql @@ -0,0 +1,3 @@ +INSERT INTO custom.users (login,name,email,email_verified_at,password,remember_token,created_at,updated_at) VALUES + ('dgavrilov',NULL,NULL,NULL,NULL,NULL,'2025-11-09 16:50:05','2025-11-09 16:50:05'), + ('developer',NULL,NULL,NULL,NULL,NULL,'2025-11-20 13:45:05','2025-11-20 13:45:05');