[WIP] Order process

This commit is contained in:
Ludovic CANDELLIER
2022-07-03 22:38:08 +02:00
parent bcb3e15f33
commit 06cfb92757
60 changed files with 1146 additions and 295 deletions

View File

@@ -0,0 +1,63 @@
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class NewUser extends Notification
{
use Queueable;
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return string[]
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$currentUser = \Auth::user();
return (new MailMessage())
->markdown('boilerplate::notifications.email')
->greeting(__('boilerplate::notifications.greeting', ['firstname' => $notifiable->first_name]))
->subject(__('boilerplate::notifications.newuser.subject', ['name' => config('app.name')]))
->line(__('boilerplate::notifications.newuser.intro', [
'name' => $currentUser->first_name.' '.$currentUser->last_name,
]))
->action(
__('boilerplate::notifications.newuser.button'),
route('boilerplate.users.firstlogin', $notifiable->remember_token)
)
->salutation(__('boilerplate::notifications.salutation', [
'name' => $currentUser->first_name.' '.$currentUser->last_name,
]))
->line(__('boilerplate::notifications.newuser.outro'));
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Notifications;
use Illuminate\Notifications\Messages\MailMessage;
class ResetPassword extends \Illuminate\Auth\Notifications\ResetPassword
{
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage())
->markdown('boilerplate::notifications.email')
->greeting(__('boilerplate::notifications.greeting', ['firstname' => $notifiable->first_name]))
->subject(__('boilerplate::notifications.resetpassword.subject'))
->line(__('boilerplate::notifications.resetpassword.intro'))
->action(
__('boilerplate::notifications.resetpassword.button'),
route('Shop.password.reset', $this->token)
)
->line(__('boilerplate::notifications.resetpassword.outro'));
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Notifications;
use Illuminate\Auth\Notifications\VerifyEmail as BaseEmail;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\URL;
class VerifyEmail extends BaseEmail
{
protected function verificationUrl($notifiable)
{
if (static::$createUrlCallback) {
return call_user_func(static::$createUrlCallback, $notifiable);
}
return URL::temporarySignedRoute(
'boilerplate.verification.verify',
Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)),
[
'id' => $notifiable->getKey(),
'hash' => sha1($notifiable->getEmailForVerification()),
]
);
}
/**
* Get the verify email notification mail message for the given URL.
*
* @param string $url
* @return \Illuminate\Notifications\Messages\MailMessage
*/
protected function buildMailMessage($url)
{
return (new MailMessage)
->markdown('boilerplate::notifications.email')
->subject(__('Verify Email Address'))
->line(__('Please click the button below to verify your email address.'))
->action(__('Verify Email Address'), $url)
->line(__('If you did not create an account, no further action is required.'));
}
}