option('email'); $tokenName = $this->option('name'); $user = User::where('email', $email)->first(); if (!$user) { $this->error("کاربر با ایمیل '{$email}' یافت نشد!"); $this->info('کاربران موجود:'); User::all(['id', 'name', 'email', 'role'])->each(function ($u) { $this->line(" - ID: {$u->id} | {$u->name} | {$u->email} | {$u->role->value}"); }); return 1; } // پاک کردن توکن‌های قبلی $oldCount = $user->tokens()->count(); $user->tokens()->delete(); $this->info("{$oldCount} توکن قدیمی پاک شد."); // ساخت توکن جدید $token = $user->createToken($tokenName)->plainTextToken; $this->newLine(); $this->line('========================================'); $this->info('توکن جدید (این را کپی کنید):'); $this->line('========================================'); $this->newLine(); $this->line($token); $this->newLine(); $this->line('========================================'); $this->newLine(); $this->info("اطلاعات کاربر:"); $this->line(" ID: {$user->id}"); $this->line(" Name: {$user->name}"); $this->line(" Email: {$user->email}"); $this->line(" Role: {$user->role->value}"); return 0; } }