Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/User/PasswordCommand.php
- This file was added.
<?php | |||||
namespace App\Console\Commands\User; | |||||
use App\Console\Command; | |||||
class PasswordCommand extends Command | |||||
{ | |||||
machniak: Two above `use`s aren't needed | |||||
/** | |||||
* The name and signature of the console command. | |||||
* | |||||
* @var string | |||||
*/ | |||||
protected $signature = 'user:password {user} {password}'; | |||||
/** | |||||
* The console command description. | |||||
* | |||||
* @var string | |||||
*/ | |||||
protected $description = 'Set a users password'; | |||||
/** | |||||
* Execute the console command. | |||||
* | |||||
* @return mixed | |||||
*/ | |||||
public function handle() | |||||
{ | |||||
$user = $this->getUser($this->argument('user'), true); | |||||
if (!$user) { | |||||
$this->error('User not found.'); | |||||
Not Done Inline ActionsI don't think we should support changing passwords on deleted users (2nd argument). Should we? machniak: I don't think we should support changing passwords on deleted users (2nd argument). Should we? | |||||
return 1; | |||||
} | |||||
$user->setPasswordAttribute($this->argument('password')); | |||||
$user->save(); | |||||
$this->info('Password updated.'); | |||||
} | |||||
} |
Two above uses aren't needed