Add preview from father, add new features
This commit is contained in:
63
app/Repositories/Core/User/Basket.php
Normal file
63
app/Repositories/Core/User/Basket.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Core\User;
|
||||
|
||||
class Basket
|
||||
{
|
||||
|
||||
public static function first($key)
|
||||
{
|
||||
$data = self::get($key);
|
||||
return array_shift($data);
|
||||
}
|
||||
|
||||
public static function last($key)
|
||||
{
|
||||
$data = self::get($key);
|
||||
return $data ? array_pop($data) : false;
|
||||
}
|
||||
|
||||
public static function set($key, $data)
|
||||
{
|
||||
return session([$key => $data]);
|
||||
}
|
||||
|
||||
public static function get($key)
|
||||
{
|
||||
return session($key);
|
||||
}
|
||||
|
||||
public static function add($key, $value)
|
||||
{
|
||||
$data = self::isExist($key) ? self::get($key) : [];
|
||||
if (array_search($value, $data) === false) {
|
||||
array_push($data, $value);
|
||||
self::set($key, $data);
|
||||
}
|
||||
return count($data);
|
||||
}
|
||||
|
||||
public static function remove($key, $value)
|
||||
{
|
||||
$data = self::get($key);
|
||||
if (($index = array_search($value, $data)) !== false) {
|
||||
unset($data[$index]);
|
||||
}
|
||||
return self::set($key, $data);
|
||||
}
|
||||
|
||||
public static function isExist($key)
|
||||
{
|
||||
return session()->has($key);
|
||||
}
|
||||
|
||||
public static function reset($key)
|
||||
{
|
||||
return session()->forget($key);
|
||||
}
|
||||
|
||||
public static function resetAll()
|
||||
{
|
||||
return session()->flush();
|
||||
}
|
||||
}
|
||||
66
app/Repositories/Core/User/Notifications/NewUser.php
Normal file
66
app/Repositories/Core/User/Notifications/NewUser.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Core\User\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('notifications.email')
|
||||
->greeting(__('notifications.greeting', ['firstname' => $notifiable->first_name]))
|
||||
->subject(__('notifications.newuser.subject', ['name' => config('app.name')]))
|
||||
->line(__('notifications.newuser.intro', [
|
||||
'name' => $currentUser->first_name.' '.$currentUser->last_name,
|
||||
]))
|
||||
->action(
|
||||
__('notifications.newuser.button'),
|
||||
route('users.firstlogin', $notifiable->remember_token)
|
||||
)
|
||||
->salutation(__('notifications.salutation', [
|
||||
'name' => $currentUser->first_name.' '.$currentUser->last_name,
|
||||
]))
|
||||
->line(__('notifications.newuser.outro'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($notifiable)
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
31
app/Repositories/Core/User/Notifications/ResetPassword.php
Normal file
31
app/Repositories/Core/User/Notifications/ResetPassword.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Core\User\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('notifications.email')
|
||||
->greeting(__('notifications.greeting', ['firstname' => $notifiable->first_name]))
|
||||
->subject(__('notifications.resetpassword.subject'))
|
||||
->line(__('notifications.resetpassword.intro'))
|
||||
->action(
|
||||
__('notifications.resetpassword.button'),
|
||||
route('password.reset', $this->token)
|
||||
)
|
||||
->line(__('notifications.resetpassword.outro'));
|
||||
}
|
||||
*/
|
||||
}
|
||||
19
app/Repositories/Core/User/PasswordResets.php
Normal file
19
app/Repositories/Core/User/PasswordResets.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Repositories\Core\User;
|
||||
|
||||
use App\Models\Core\Auth\PasswordReset;
|
||||
|
||||
class PasswordResets
|
||||
{
|
||||
|
||||
public static function getTokenByEmail($email)
|
||||
{
|
||||
return PasswordReset::byEmail($email)->first();
|
||||
}
|
||||
|
||||
public static function getEmailByToken($token)
|
||||
{
|
||||
return PasswordReset::byToken($token)->first();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user