refactor
This commit is contained in:
@@ -15,9 +15,9 @@ class InstanceSettings extends Model implements SendsEmail
|
||||
protected $casts = [
|
||||
'resale_license' => 'encrypted',
|
||||
];
|
||||
public function routeNotificationForEmail(string $attribute = 'test_recipients')
|
||||
public function getRecepients($notification)
|
||||
{
|
||||
$recipients = data_get($this,'smtp','');
|
||||
$recipients = data_get($notification,'emails',null);
|
||||
if (is_null($recipients) || $recipients === '') {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -23,11 +23,14 @@ class Team extends Model implements SendsDiscord, SendsEmail
|
||||
{
|
||||
return data_get($this, 'discord_webhook_url', null);
|
||||
}
|
||||
public function routeNotificationForEmail(string $attribute = 'recipients')
|
||||
public function getRecepients($notification)
|
||||
{
|
||||
$recipients = data_get($this, 'smtp_recipients', '');
|
||||
if (is_null($recipients) || $recipients === '') {
|
||||
return [];
|
||||
$recipients = data_get($notification,'emails',null);
|
||||
ray($recipients);
|
||||
if (is_null($recipients)) {
|
||||
$recipients = $this->members()->pluck('email')->toArray();
|
||||
ray($recipients);
|
||||
return $recipients;
|
||||
}
|
||||
return explode(',', $recipients);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use Visus\Cuid2\Cuid2;
|
||||
use Laravel\Fortify\TwoFactorAuthenticatable;
|
||||
use App\Notifications\TrnsactionalEmails\ResetPassword;
|
||||
|
||||
class User extends Authenticatable implements SendsEmail
|
||||
{
|
||||
@@ -43,10 +44,14 @@ class User extends Authenticatable implements SendsEmail
|
||||
$user->teams()->attach($new_team, ['role' => 'owner']);
|
||||
});
|
||||
}
|
||||
public function routeNotificationForEmail()
|
||||
public function getRecepients($notification)
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
public function sendPasswordResetNotification($token): void
|
||||
{
|
||||
$this->notify(new ResetPassword($token));
|
||||
}
|
||||
public function isAdmin()
|
||||
{
|
||||
return $this->pivot->role === 'admin' || $this->pivot->role === 'owner';
|
||||
|
||||
Reference in New Issue
Block a user