add: full multi-tenancy control
This commit is contained in:
38
packages/Webkul/Admin/src/Notifications/Common.php
Normal file
38
packages/Webkul/Admin/src/Notifications/Common.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Webkul\Admin\Notifications;
|
||||
|
||||
use Illuminate\Mail\Mailable;
|
||||
|
||||
class Common extends Mailable
|
||||
{
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public $data) {}
|
||||
|
||||
/**
|
||||
* Build the mail representation of the notification.
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
$message = $this
|
||||
->to($this->data['to'])
|
||||
->subject($this->data['subject'])
|
||||
->view('admin::emails.common.index', [
|
||||
'body' => $this->data['body'],
|
||||
]);
|
||||
|
||||
if (isset($this->data['attachments'])) {
|
||||
foreach ($this->data['attachments'] as $attachment) {
|
||||
$message->attachData($attachment['content'], $attachment['name'], [
|
||||
'mime' => $attachment['mime'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
27
packages/Webkul/Admin/src/Notifications/User/Create.php
Normal file
27
packages/Webkul/Admin/src/Notifications/User/Create.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Webkul\Admin\Notifications\User;
|
||||
|
||||
use Illuminate\Mail\Mailable;
|
||||
|
||||
class Create extends Mailable
|
||||
{
|
||||
/**
|
||||
* @param object $user
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public $user) {}
|
||||
|
||||
/**
|
||||
* Build the mail representation of the notification.
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this
|
||||
->to($this->user->email)
|
||||
->subject(trans('admin::app.emails.common.user.create-subject'))
|
||||
->view('admin::emails.users.create', [
|
||||
'user_name' => $this->user->name,
|
||||
]);
|
||||
}
|
||||
}
|
||||
28
packages/Webkul/Admin/src/Notifications/User/UserResetPassword.php
Executable file
28
packages/Webkul/Admin/src/Notifications/User/UserResetPassword.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Webkul\Admin\Notifications\User;
|
||||
|
||||
use Illuminate\Auth\Notifications\ResetPassword;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
class UserResetPassword extends ResetPassword
|
||||
{
|
||||
/**
|
||||
* Build the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
if (static::$toMailCallback) {
|
||||
return call_user_func(static::$toMailCallback, $notifiable, $this->token);
|
||||
}
|
||||
|
||||
return (new MailMessage)
|
||||
->view('admin::emails.users.forget-password', [
|
||||
'user_name' => $notifiable->name,
|
||||
'token' => $this->token,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Webkul\Admin\Notifications\User;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class UserUpdatePassword extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new admin instance.
|
||||
*
|
||||
* @param \Webkul\User\Contracts\User $user
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(public $user) {}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->from(core()->getSenderEmailDetails()['email'], core()->getSenderEmailDetails()['name'])
|
||||
->to($this->user->email, $this->user->name)
|
||||
->subject(trans('shop::app.mail.update-password.subject'))
|
||||
->view('shop::emails.users.update-password', ['user' => $this->user]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user