MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/www/mpl.imenso.co/app/Console/Commands/UpdateAdminPasswords.php
<?php

namespace App\Console\Commands;

use App\Models\User;
use Faker\Factory;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Hash;

class UpdateAdminPasswords extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'mpl:update-admin-passwords';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'This command seeds all admin accounts on MPL with a fresh password.';

    protected $passwords = [];

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $faker = Factory::create();

        User::where('type_id', 5)
            ->each(function ($user) use ($faker) {
                $password = $faker->word().$faker->word().$faker->randomLetter.$faker->numberBetween(9, 56);

                $user->password = Hash::make($password);
                $user->save();

                $this->passwords[$user->email] = $password;
            });

        $this->info('In no particular order, here are the freshly generated passwords:');

        foreach ($this->passwords as $email => $password) {
            $this->line("{$email} - $password");
        }
    }
}