Skip to content

Commit

Permalink
Adding comands
Browse files Browse the repository at this point in the history
  • Loading branch information
MinePoS Dedicated committed Sep 24, 2018
1 parent 535baff commit 0286ce9
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
50 changes: 50 additions & 0 deletions app/Console/Commands/ChangeEmail.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class ChangeEmail extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'user:email {email} {newemail}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Change your MinePoS email';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$u = \App\User::where("email",$this->argument('email'))->get();
if(sizeof($u) > 0){
$u = $u[0];
//$this->info($u->password);
$u->email = $this->argument('newemail');
$u->save();
$this->info('Email Changed!');
}else{
$this->error('This email isnt linked to a MinePoS admin account!');
}
}
}
51 changes: 51 additions & 0 deletions app/Console/Commands/ResetPassword.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class ResetPassword extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'user:passwd {email} {passwd}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Change your MinePoS password';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$u = \App\User::where("email",$this->argument('email'))->get();
if(sizeof($u) > 0){
$u = $u[0];
//$this->info($u->password);
$u->password = \Hash::make($this->argument('passwd'));
$u->save();
$this->info('Password Changed!');
}else{
$this->error('This email isnt linked to a MinePoS admin account!');
}
}
}

0 comments on commit 0286ce9

Please sign in to comment.