Added email and password reset

This commit is contained in:
Deon George
2018-08-07 14:26:33 +10:00
parent 46db6537d6
commit a99834a6d1
21 changed files with 2273 additions and 4096 deletions

View File

@@ -8,6 +8,7 @@ use Laravel\Passport\HasApiTokens;
use Leenooks\Carbon;
use Leenooks\Traits\UserSwitch;
use App\Notifications\ResetPasswordNotification;
class User extends Authenticatable
{
@@ -164,14 +165,19 @@ class User extends Authenticatable
return sprintf('<a href="/u/account/view/%s">%s</a>',$this->id,$this->user_id);
}
public function scopeActive()
{
return $this->where('active',TRUE);
}
public function isAdmin($id)
{
return $id AND in_array($this->role(),['wholesaler','reseller']) AND in_array($id,$this->all_accounts()->pluck('id')->toArray());
}
public function scopeActive()
public function sendPasswordResetNotification($token)
{
return $this->where('active',TRUE);
$this->notify(new ResetPasswordNotification($token));
}
// List all the agents, including agents of agents