mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 06:46:08 -06:00
commit
477708a8e2
69
app/Notification/ActivateYourAccount.php
Normal file
69
app/Notification/ActivateYourAccount.php
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?php namespace App\Notification;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Notification\Message\MailMessage;
|
||||||
|
use Anomaly\UsersModule\User\Contract\UserInterface;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ActivateYourAccount
|
||||||
|
*
|
||||||
|
* @link http://pyrocms.com/
|
||||||
|
* @author PyroCMS, Inc. <support@pyrocms.com>
|
||||||
|
* @author Ryan Thompson <ryan@pyrocms.com>
|
||||||
|
*/
|
||||||
|
class ActivateYourAccount extends Notification implements ShouldQueue
|
||||||
|
{
|
||||||
|
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redirect here after activating.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $redirect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new UserHasRegistered instance.
|
||||||
|
*
|
||||||
|
* @param $redirect
|
||||||
|
*/
|
||||||
|
public function __construct($redirect = '/')
|
||||||
|
{
|
||||||
|
$this->redirect = $redirect;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the notification's delivery channels.
|
||||||
|
*
|
||||||
|
* @param UserInterface $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function via(UserInterface $notifiable)
|
||||||
|
{
|
||||||
|
return ['mail'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the mail message.
|
||||||
|
*
|
||||||
|
* @param UserInterface $notifiable
|
||||||
|
* @return MailMessage
|
||||||
|
*/
|
||||||
|
public function toMail(UserInterface $notifiable)
|
||||||
|
{
|
||||||
|
$data = $notifiable->attributesToArray();
|
||||||
|
|
||||||
|
return (new MailMessage())
|
||||||
|
->view('anomaly.module.users::notifications.activate_your_account')
|
||||||
|
->subject(trans('anomaly.module.users::notification.activate_your_account.subject', $data))
|
||||||
|
->greeting(trans('anomaly.module.users::notification.activate_your_account.greeting', $data))
|
||||||
|
->line(trans('anomaly.module.users::notification.activate_your_account.instructions', $data))
|
||||||
|
->action(
|
||||||
|
trans('anomaly.module.users::notification.activate_your_account.button', $data),
|
||||||
|
$notifiable->route('activate', ['redirect' => $this->redirect])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
72
app/Notification/PasswordInvalidated.php
Normal file
72
app/Notification/PasswordInvalidated.php
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?php namespace App\Notification;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Notification\Message\MailMessage;
|
||||||
|
use Anomaly\UsersModule\User\Contract\UserInterface;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class PasswordInvalidated
|
||||||
|
*
|
||||||
|
* @link http://pyrocms.com/
|
||||||
|
* @author PyroCMS, Inc. <support@pyrocms.com>
|
||||||
|
* @author Ryan Thompson <ryan@pyrocms.com>
|
||||||
|
*/
|
||||||
|
class PasswordInvalidated extends Notification implements ShouldQueue
|
||||||
|
{
|
||||||
|
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redirect here after activating.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $redirect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new UserHasRegistered instance.
|
||||||
|
*
|
||||||
|
* @param $redirect
|
||||||
|
*/
|
||||||
|
public function __construct($redirect = '/')
|
||||||
|
{
|
||||||
|
$this->redirect = $redirect;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the notification's delivery channels.
|
||||||
|
*
|
||||||
|
* @param UserInterface $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function via(UserInterface $notifiable)
|
||||||
|
{
|
||||||
|
return ['mail'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the mail message.
|
||||||
|
*
|
||||||
|
* @param UserInterface $notifiable
|
||||||
|
* @return MailMessage
|
||||||
|
*/
|
||||||
|
public function toMail(UserInterface $notifiable)
|
||||||
|
{
|
||||||
|
$data = $notifiable->attributesToArray();
|
||||||
|
|
||||||
|
return (new MailMessage())
|
||||||
|
->error()
|
||||||
|
->view('anomaly.module.users::notifications.password_invalidated')
|
||||||
|
->subject(trans('anomaly.module.users::notification.password_invalidated.subject', $data))
|
||||||
|
->greeting(trans('anomaly.module.users::notification.password_invalidated.greeting', $data))
|
||||||
|
->line(trans('anomaly.module.users::notification.password_invalidated.notice', $data))
|
||||||
|
->line(trans('anomaly.module.users::notification.password_invalidated.warning', $data))
|
||||||
|
->line(trans('anomaly.module.users::notification.password_invalidated.instructions', $data))
|
||||||
|
->action(
|
||||||
|
trans('anomaly.module.users::notification.password_invalidated.button', $data),
|
||||||
|
$notifiable->route('reset', ['redirect' => $this->redirect])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
72
app/Notification/ResetYourPassword.php
Normal file
72
app/Notification/ResetYourPassword.php
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?php namespace App\Notification;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Notification\Message\MailMessage;
|
||||||
|
use Anomaly\UsersModule\User\Contract\UserInterface;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ResetYourPassword
|
||||||
|
*
|
||||||
|
* @link http://pyrocms.com/
|
||||||
|
* @author PyroCMS, Inc. <support@pyrocms.com>
|
||||||
|
* @author Ryan Thompson <ryan@pyrocms.com>
|
||||||
|
*/
|
||||||
|
class ResetYourPassword extends Notification implements ShouldQueue
|
||||||
|
{
|
||||||
|
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redirect here after activating.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public $redirect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new UserHasRegistered instance.
|
||||||
|
*
|
||||||
|
* @param $redirect
|
||||||
|
*/
|
||||||
|
public function __construct($redirect = '/')
|
||||||
|
{
|
||||||
|
$this->redirect = $redirect;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the notification's delivery channels.
|
||||||
|
*
|
||||||
|
* @param UserInterface $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function via(UserInterface $notifiable)
|
||||||
|
{
|
||||||
|
return ['mail'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the mail message.
|
||||||
|
*
|
||||||
|
* @param UserInterface $notifiable
|
||||||
|
* @return MailMessage
|
||||||
|
*/
|
||||||
|
public function toMail(UserInterface $notifiable)
|
||||||
|
{
|
||||||
|
$data = $notifiable->attributesToArray();
|
||||||
|
|
||||||
|
return (new MailMessage())
|
||||||
|
->error()
|
||||||
|
->view('anomaly.module.users::notifications.reset_your_password')
|
||||||
|
->subject(trans('anomaly.module.users::notification.reset_your_password.subject', $data))
|
||||||
|
->greeting(trans('anomaly.module.users::notification.reset_your_password.greeting', $data))
|
||||||
|
->line(trans('anomaly.module.users::notification.reset_your_password.notice', $data))
|
||||||
|
->line(trans('anomaly.module.users::notification.reset_your_password.warning', $data))
|
||||||
|
->line(trans('anomaly.module.users::notification.reset_your_password.instructions', $data))
|
||||||
|
->action(
|
||||||
|
trans('anomaly.module.users::notification.reset_your_password.button', $data),
|
||||||
|
$notifiable->route('reset', ['redirect' => $this->redirect])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
52
app/Notification/UserHasBeenActivated.php
Normal file
52
app/Notification/UserHasBeenActivated.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php namespace App\Notification;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Notification\Message\MailMessage;
|
||||||
|
use Anomaly\UsersModule\User\Contract\UserInterface;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class UserHasBeenActivated
|
||||||
|
*
|
||||||
|
* @link http://pyrocms.com/
|
||||||
|
* @author PyroCMS, Inc. <support@pyrocms.com>
|
||||||
|
* @author Ryan Thompson <ryan@pyrocms.com>
|
||||||
|
*/
|
||||||
|
class UserHasBeenActivated extends Notification implements ShouldQueue
|
||||||
|
{
|
||||||
|
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the notification's delivery channels.
|
||||||
|
*
|
||||||
|
* @param UserInterface $notifiable
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function via(UserInterface $notifiable)
|
||||||
|
{
|
||||||
|
return ['mail'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the mail message.
|
||||||
|
*
|
||||||
|
* @param UserInterface $notifiable
|
||||||
|
* @return MailMessage
|
||||||
|
*/
|
||||||
|
public function toMail(UserInterface $notifiable)
|
||||||
|
{
|
||||||
|
$data = $notifiable->attributesToArray();
|
||||||
|
|
||||||
|
return (new MailMessage())
|
||||||
|
->view('anomaly.module.users::notifications.user_has_been_activated')
|
||||||
|
->subject(trans('anomaly.module.users::notification.user_has_been_activated.subject', $data))
|
||||||
|
->greeting(trans('anomaly.module.users::notification.user_has_been_activated.greeting', $data))
|
||||||
|
->line(trans('anomaly.module.users::notification.user_has_been_activated.instructions', $data))
|
||||||
|
->action(
|
||||||
|
trans('anomaly.module.users::notification.user_has_been_activated.button', $data),
|
||||||
|
route('anomaly.module.users::login')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
110
app/Notification/UserHasRegistered.php
Normal file
110
app/Notification/UserHasRegistered.php
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
<?php namespace App\Notification;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Notification\Message\MailMessage;
|
||||||
|
use Anomaly\UsersModule\User\Contract\UserInterface;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Notifications\AnonymousNotifiable;
|
||||||
|
use Illuminate\Notifications\Messages\SlackMessage;
|
||||||
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class UserHasRegistered
|
||||||
|
*
|
||||||
|
* @link http://pyrocms.com/
|
||||||
|
* @author PyroCMS, Inc. <support@pyrocms.com>
|
||||||
|
* @author Ryan Thompson <ryan@pyrocms.com>
|
||||||
|
*/
|
||||||
|
class UserHasRegistered extends Notification implements ShouldQueue
|
||||||
|
{
|
||||||
|
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user who registered.
|
||||||
|
*
|
||||||
|
* @var UserInterface
|
||||||
|
*/
|
||||||
|
public $user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new UserHasRegistered instance.
|
||||||
|
*
|
||||||
|
* @param UserInterface $user
|
||||||
|
*/
|
||||||
|
public function __construct(UserInterface $user)
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the notification's delivery channels.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function via()
|
||||||
|
{
|
||||||
|
return ['mail', 'slack'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the mail message.
|
||||||
|
*
|
||||||
|
* @param AnonymousNotifiable $notifiable
|
||||||
|
* @return MailMessage
|
||||||
|
*/
|
||||||
|
public function toMail(AnonymousNotifiable $notifiable)
|
||||||
|
{
|
||||||
|
$data = $this->user->attributesToArray();
|
||||||
|
|
||||||
|
return (new MailMessage())
|
||||||
|
->view('anomaly.module.users::notifications.user_has_registered')
|
||||||
|
->subject(trans('anomaly.module.users::notification.user_has_registered.subject', $data))
|
||||||
|
->line(trans('anomaly.module.users::notification.user_has_registered.instructions', $data))
|
||||||
|
->action(
|
||||||
|
trans('anomaly.module.users::notification.user_has_registered.button', $data),
|
||||||
|
$this->user->route('view')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the slack message.
|
||||||
|
*
|
||||||
|
* @param UserInterface $notifiable
|
||||||
|
*
|
||||||
|
* @return SlackMessage
|
||||||
|
*/
|
||||||
|
public function toSlack(UserInterface $notifiable)
|
||||||
|
{
|
||||||
|
return (new SlackMessage())
|
||||||
|
->success()
|
||||||
|
->content('Hmm.. What\'s Ryan up to?')
|
||||||
|
->attachment(
|
||||||
|
function ($attachment) {
|
||||||
|
$attachment
|
||||||
|
->title('Testing out teh goodies!', 'http://pyrocms.com/')
|
||||||
|
->fields(
|
||||||
|
[
|
||||||
|
'Username' => $this->user->getUsername(),
|
||||||
|
'Eamil' => $this->user->getEmail(),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the array storage data.
|
||||||
|
*
|
||||||
|
* @param Notifiable $notifiable
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toDatabase(UserInterface $notifiable)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'user' => $this->user,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
68
app/Notification/UserPendingActivation.php
Normal file
68
app/Notification/UserPendingActivation.php
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<?php namespace App\Notification;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Notification\Message\MailMessage;
|
||||||
|
use Anomaly\UsersModule\User\Contract\UserInterface;
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Notifications\AnonymousNotifiable;
|
||||||
|
use Illuminate\Notifications\Notification;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class UserPendingActivation
|
||||||
|
*
|
||||||
|
* @link http://pyrocms.com/
|
||||||
|
* @author PyroCMS, Inc. <support@pyrocms.com>
|
||||||
|
* @author Ryan Thompson <ryan@pyrocms.com>
|
||||||
|
*/
|
||||||
|
class UserPendingActivation extends Notification implements ShouldQueue
|
||||||
|
{
|
||||||
|
|
||||||
|
use Queueable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The user pending activation.
|
||||||
|
*
|
||||||
|
* @var UserInterface
|
||||||
|
*/
|
||||||
|
public $user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new UserPendingActivation instance.
|
||||||
|
*
|
||||||
|
* @param UserInterface $user
|
||||||
|
*/
|
||||||
|
public function __construct(UserInterface $user)
|
||||||
|
{
|
||||||
|
$this->user = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the notification's delivery channels.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function via()
|
||||||
|
{
|
||||||
|
return ['mail'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the mail message.
|
||||||
|
*
|
||||||
|
* @param AnonymousNotifiable $notifiable
|
||||||
|
* @return MailMessage
|
||||||
|
*/
|
||||||
|
public function toMail(AnonymousNotifiable $notifiable)
|
||||||
|
{
|
||||||
|
$data = $this->user->attributesToArray();
|
||||||
|
|
||||||
|
return (new MailMessage())
|
||||||
|
->view('anomaly.module.users::notifications.user_pending_activation')
|
||||||
|
->subject(trans('anomaly.module.users::notification.user_pending_activation.subject', $data))
|
||||||
|
->line(trans('anomaly.module.users::notification.user_pending_activation.instructions', $data))
|
||||||
|
->action(
|
||||||
|
trans('anomaly.module.users::notification.user_pending_activation.button', $data),
|
||||||
|
url('admin/users?view=pending')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -260,6 +260,21 @@ return [
|
|||||||
'URL' => Illuminate\Support\Facades\URL::class,
|
'URL' => Illuminate\Support\Facades\URL::class,
|
||||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||||
'View' => Illuminate\Support\Facades\View::class,
|
'View' => Illuminate\Support\Facades\View::class,
|
||||||
'Sentry' => Sentry\Laravel\Facade::class
|
'Sentry' => Sentry\Laravel\Facade::class,
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Todo
|
||||||
|
* 30.11.2022
|
||||||
|
* It has been added for the use of 'with' in the PyroCMS Users Model file.
|
||||||
|
* Translate(trans) function does not accept nested arrays.
|
||||||
|
*/
|
||||||
|
'Anomaly\UsersModule\User\Notification\ActivateYourAccount' => \App\Notification\ActivateYourAccount::class,
|
||||||
|
'Anomaly\UsersModule\User\Notification\PasswordInvalidated' => \App\Notification\PasswordInvalidated::class,
|
||||||
|
'Anomaly\UsersModule\User\Notification\ResetYourPassword' => \App\Notification\ResetYourPassword::class,
|
||||||
|
'Anomaly\UsersModule\User\Notification\UserHasBeenActivated' => \App\Notification\UserHasBeenActivated::class,
|
||||||
|
'Anomaly\UsersModule\User\Notification\UserHasRegistered' => \App\Notification\UserHasRegistered::class,
|
||||||
|
'Anomaly\UsersModule\User\Notification\UserPendingActivation' => \App\Notification\UserPendingActivation::class,
|
||||||
|
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user