first commit
This commit is contained in:
5
vendor/php-flasher/flasher-laravel/.github/FUNDING.yml
vendored
Normal file
5
vendor/php-flasher/flasher-laravel/.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
github: yoeunes
|
||||
patreon: yoeunes
|
||||
ko_fi: yoeunes
|
||||
open_collective: php-flasher
|
||||
custom: https://www.paypal.com/paypalme/yoeunes
|
22
vendor/php-flasher/flasher-laravel/.github/workflows/auto_closer.yaml
vendored
Normal file
22
vendor/php-flasher/flasher-laravel/.github/workflows/auto_closer.yaml
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
name: Auto Closer PR
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
|
||||
jobs:
|
||||
run:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: superbrothers/close-pull-request@v3
|
||||
with:
|
||||
comment: |
|
||||
Hi, thank you for your contribution.
|
||||
|
||||
Unfortunately, this repository is read-only. It's a split from our main monorepo repository.
|
||||
|
||||
We'd like to kindly ask you to move the contribution there - https://github.com/php-flasher/php-flasher.
|
||||
|
||||
We'll check it, review it and give you feed back right way.
|
||||
|
||||
Thank you.
|
135
vendor/php-flasher/flasher-laravel/.phpstorm.meta.php
vendored
Normal file
135
vendor/php-flasher/flasher-laravel/.phpstorm.meta.php
vendored
Normal file
@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace PHPSTORM_META;
|
||||
|
||||
override(new \Illuminate\Contracts\Container\Container, map([
|
||||
'' => '@',
|
||||
'Flasher\Prime\FlasherInterface' => \Flasher\Prime\Flasher::class,
|
||||
'flasher' => \Flasher\Prime\Flasher::class,
|
||||
'flasher.noty' => \Flasher\Noty\Prime\NotyFactory::class,
|
||||
'flasher.notyf' => \Flasher\Notyf\Prime\NotyfFactory::class,
|
||||
'flasher.pnotify' => \Flasher\Pnotify\Prime\PnotifyFactory::class,
|
||||
'flasher.sweetalert' => \Flasher\SweetAlert\Prime\SweetAlertFactory::class,
|
||||
'flasher.template' => \Flasher\Prime\Factory\FlasherFactory::class,
|
||||
'flasher.toastr' => \Flasher\Toastr\Prime\ToastrFactory::class,
|
||||
]));
|
||||
|
||||
override(\Illuminate\Container\Container::makeWith(0), map([
|
||||
'' => '@',
|
||||
'Flasher\Prime\FlasherInterface' => \Flasher\Prime\Flasher::class,
|
||||
'flasher' => \Flasher\Prime\Flasher::class,
|
||||
'flasher.noty' => \Flasher\Noty\Prime\NotyFactory::class,
|
||||
'flasher.notyf' => \Flasher\Notyf\Prime\NotyfFactory::class,
|
||||
'flasher.pnotify' => \Flasher\Pnotify\Prime\PnotifyFactory::class,
|
||||
'flasher.sweetalert' => \Flasher\SweetAlert\Prime\SweetAlertFactory::class,
|
||||
'flasher.template' => \Flasher\Prime\Factory\FlasherFactory::class,
|
||||
'flasher.toastr' => \Flasher\Toastr\Prime\ToastrFactory::class,
|
||||
]));
|
||||
|
||||
override(\Illuminate\Contracts\Container\Container::get(0), map([
|
||||
'' => '@',
|
||||
'Flasher\Prime\FlasherInterface' => \Flasher\Prime\Flasher::class,
|
||||
'flasher' => \Flasher\Prime\Flasher::class,
|
||||
'flasher.noty' => \Flasher\Noty\Prime\NotyFactory::class,
|
||||
'flasher.notyf' => \Flasher\Notyf\Prime\NotyfFactory::class,
|
||||
'flasher.pnotify' => \Flasher\Pnotify\Prime\PnotifyFactory::class,
|
||||
'flasher.sweetalert' => \Flasher\SweetAlert\Prime\SweetAlertFactory::class,
|
||||
'flasher.template' => \Flasher\Prime\Factory\FlasherFactory::class,
|
||||
'flasher.toastr' => \Flasher\Toastr\Prime\ToastrFactory::class,
|
||||
]));
|
||||
|
||||
override(\Illuminate\Contracts\Container\Container::make(0), map([
|
||||
'' => '@',
|
||||
'Flasher\Prime\FlasherInterface' => \Flasher\Prime\Flasher::class,
|
||||
'flasher' => \Flasher\Prime\Flasher::class,
|
||||
'flasher.noty' => \Flasher\Noty\Prime\NotyFactory::class,
|
||||
'flasher.notyf' => \Flasher\Notyf\Prime\NotyfFactory::class,
|
||||
'flasher.pnotify' => \Flasher\Pnotify\Prime\PnotifyFactory::class,
|
||||
'flasher.sweetalert' => \Flasher\SweetAlert\Prime\SweetAlertFactory::class,
|
||||
'flasher.template' => \Flasher\Prime\Factory\FlasherFactory::class,
|
||||
'flasher.toastr' => \Flasher\Toastr\Prime\ToastrFactory::class,
|
||||
]));
|
||||
|
||||
override(\Illuminate\Contracts\Container\Container::makeWith(0), map([
|
||||
'' => '@',
|
||||
'Flasher\Prime\FlasherInterface' => \Flasher\Prime\Flasher::class,
|
||||
'flasher' => \Flasher\Prime\Flasher::class,
|
||||
'flasher.noty' => \Flasher\Noty\Prime\NotyFactory::class,
|
||||
'flasher.notyf' => \Flasher\Notyf\Prime\NotyfFactory::class,
|
||||
'flasher.pnotify' => \Flasher\Pnotify\Prime\PnotifyFactory::class,
|
||||
'flasher.sweetalert' => \Flasher\SweetAlert\Prime\SweetAlertFactory::class,
|
||||
'flasher.template' => \Flasher\Prime\Factory\FlasherFactory::class,
|
||||
'flasher.toastr' => \Flasher\Toastr\Prime\ToastrFactory::class,
|
||||
]));
|
||||
|
||||
override(\App::get(0), map([
|
||||
'' => '@',
|
||||
'Flasher\Prime\FlasherInterface' => \Flasher\Prime\Flasher::class,
|
||||
'flasher' => \Flasher\Prime\Flasher::class,
|
||||
'flasher.noty' => \Flasher\Noty\Prime\NotyFactory::class,
|
||||
'flasher.notyf' => \Flasher\Notyf\Prime\NotyfFactory::class,
|
||||
'flasher.pnotify' => \Flasher\Pnotify\Prime\PnotifyFactory::class,
|
||||
'flasher.sweetalert' => \Flasher\SweetAlert\Prime\SweetAlertFactory::class,
|
||||
'flasher.template' => \Flasher\Prime\Factory\FlasherFactory::class,
|
||||
'flasher.toastr' => \Flasher\Toastr\Prime\ToastrFactory::class,
|
||||
]));
|
||||
|
||||
override(\App::make(0), map([
|
||||
'' => '@',
|
||||
'Flasher\Prime\FlasherInterface' => \Flasher\Prime\Flasher::class,
|
||||
'flasher' => \Flasher\Prime\Flasher::class,
|
||||
'flasher.noty' => \Flasher\Noty\Prime\NotyFactory::class,
|
||||
'flasher.notyf' => \Flasher\Notyf\Prime\NotyfFactory::class,
|
||||
'flasher.pnotify' => \Flasher\Pnotify\Prime\PnotifyFactory::class,
|
||||
'flasher.sweetalert' => \Flasher\SweetAlert\Prime\SweetAlertFactory::class,
|
||||
'flasher.template' => \Flasher\Prime\Factory\FlasherFactory::class,
|
||||
'flasher.toastr' => \Flasher\Toastr\Prime\ToastrFactory::class,
|
||||
]));
|
||||
|
||||
override(\App::makeWith(0), map([
|
||||
'' => '@',
|
||||
'Flasher\Prime\FlasherInterface' => \Flasher\Prime\Flasher::class,
|
||||
'flasher' => \Flasher\Prime\Flasher::class,
|
||||
'flasher.noty' => \Flasher\Noty\Prime\NotyFactory::class,
|
||||
'flasher.notyf' => \Flasher\Notyf\Prime\NotyfFactory::class,
|
||||
'flasher.pnotify' => \Flasher\Pnotify\Prime\PnotifyFactory::class,
|
||||
'flasher.sweetalert' => \Flasher\SweetAlert\Prime\SweetAlertFactory::class,
|
||||
'flasher.template' => \Flasher\Prime\Factory\FlasherFactory::class,
|
||||
'flasher.toastr' => \Flasher\Toastr\Prime\ToastrFactory::class,
|
||||
]));
|
||||
|
||||
override(\app(0), map([
|
||||
'' => '@',
|
||||
'Flasher\Prime\FlasherInterface' => \Flasher\Prime\Flasher::class,
|
||||
'flasher' => \Flasher\Prime\Flasher::class,
|
||||
'flasher.noty' => \Flasher\Noty\Prime\NotyFactory::class,
|
||||
'flasher.notyf' => \Flasher\Notyf\Prime\NotyfFactory::class,
|
||||
'flasher.pnotify' => \Flasher\Pnotify\Prime\PnotifyFactory::class,
|
||||
'flasher.sweetalert' => \Flasher\SweetAlert\Prime\SweetAlertFactory::class,
|
||||
'flasher.template' => \Flasher\Prime\Factory\FlasherFactory::class,
|
||||
'flasher.toastr' => \Flasher\Toastr\Prime\ToastrFactory::class,
|
||||
]));
|
||||
|
||||
override(\resolve(0), map([
|
||||
'' => '@',
|
||||
'Flasher\Prime\FlasherInterface' => \Flasher\Prime\Flasher::class,
|
||||
'flasher' => \Flasher\Prime\Flasher::class,
|
||||
'flasher.noty' => \Flasher\Noty\Prime\NotyFactory::class,
|
||||
'flasher.notyf' => \Flasher\Notyf\Prime\NotyfFactory::class,
|
||||
'flasher.pnotify' => \Flasher\Pnotify\Prime\PnotifyFactory::class,
|
||||
'flasher.sweetalert' => \Flasher\SweetAlert\Prime\SweetAlertFactory::class,
|
||||
'flasher.template' => \Flasher\Prime\Factory\FlasherFactory::class,
|
||||
'flasher.toastr' => \Flasher\Toastr\Prime\ToastrFactory::class,
|
||||
]));
|
||||
|
||||
override(\Psr\Container\ContainerInterface::get(0), map([
|
||||
'' => '@',
|
||||
'Flasher\Prime\FlasherInterface' => \Flasher\Prime\Flasher::class,
|
||||
'flasher' => \Flasher\Prime\Flasher::class,
|
||||
'flasher.noty' => \Flasher\Noty\Prime\NotyFactory::class,
|
||||
'flasher.notyf' => \Flasher\Notyf\Prime\NotyfFactory::class,
|
||||
'flasher.pnotify' => \Flasher\Pnotify\Prime\PnotifyFactory::class,
|
||||
'flasher.sweetalert' => \Flasher\SweetAlert\Prime\SweetAlertFactory::class,
|
||||
'flasher.template' => \Flasher\Prime\Factory\FlasherFactory::class,
|
||||
'flasher.toastr' => \Flasher\Toastr\Prime\ToastrFactory::class,
|
||||
]));
|
28
vendor/php-flasher/flasher-laravel/Bridge/Command/FlasherCommand.php
vendored
Normal file
28
vendor/php-flasher/flasher-laravel/Bridge/Command/FlasherCommand.php
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Bridge\Command;
|
||||
|
||||
use Flasher\Laravel\Support\Laravel;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
$class = Laravel::isVersion('11.0', '>=')
|
||||
? 'Flasher\Laravel\Bridge\Typed\Command\FlasherCommand'
|
||||
: 'Flasher\Laravel\Bridge\Legacy\Command\FlasherCommand';
|
||||
|
||||
class_alias($class, 'Flasher\Laravel\Bridge\Command\FlasherCommand');
|
||||
|
||||
if (false) { /** @phpstan-ignore-line */
|
||||
abstract class FlasherCommand
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
abstract protected function flasherExecute(InputInterface $input, OutputInterface $output);
|
||||
}
|
||||
}
|
25
vendor/php-flasher/flasher-laravel/Bridge/Legacy/Command/FlasherCommand.php
vendored
Normal file
25
vendor/php-flasher/flasher-laravel/Bridge/Legacy/Command/FlasherCommand.php
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Bridge\Legacy\Command;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
abstract class FlasherCommand extends Command
|
||||
{
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
return $this->flasherExecute($input, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
abstract protected function flasherExecute(InputInterface $input, OutputInterface $output);
|
||||
}
|
25
vendor/php-flasher/flasher-laravel/Bridge/Typed/Command/FlasherCommand.php
vendored
Normal file
25
vendor/php-flasher/flasher-laravel/Bridge/Typed/Command/FlasherCommand.php
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Bridge\Typed\Command;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
abstract class FlasherCommand extends Command
|
||||
{
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
return $this->flasherExecute($input, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
abstract protected function flasherExecute(InputInterface $input, OutputInterface $output);
|
||||
}
|
128
vendor/php-flasher/flasher-laravel/Command/InstallCommand.php
vendored
Normal file
128
vendor/php-flasher/flasher-laravel/Command/InstallCommand.php
vendored
Normal file
@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Command;
|
||||
|
||||
use Flasher\Laravel\Support\ServiceProvider as FlasherServiceProvider;
|
||||
use Flasher\Prime\Plugin\PluginInterface;
|
||||
use Flasher\Laravel\Bridge\Command\FlasherCommand;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class InstallCommand extends FlasherCommand
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('flasher:install')
|
||||
->setDescription('Installs all <fg=blue;options=bold>PHPFlasher</> resources to the <comment>public</comment> and <comment>config</comment> directories.')
|
||||
->setHelp('The command copies <fg=blue;options=bold>PHPFlasher</> assets to <comment>public/vendor/flasher/</comment> directory and config files to the <comment>config/</comment> directory without overwriting any existing config files.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
protected function flasherExecute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$output->writeln('');
|
||||
$output->writeln('<fg=blue;options=bold>
|
||||
██████╗ ██╗ ██╗██████╗ ███████╗██╗ █████╗ ███████╗██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██║ ██║██╔══██╗██╔════╝██║ ██╔══██╗██╔════╝██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝███████║██████╔╝█████╗ ██║ ███████║███████╗███████║█████╗ ██████╔╝
|
||||
██╔═══╝ ██╔══██║██╔═══╝ ██╔══╝ ██║ ██╔══██║╚════██║██╔══██║██╔══╝ ██╔══██╗
|
||||
██║ ██║ ██║██║ ██║ ███████╗██║ ██║███████║██║ ██║███████╗██║ ██║
|
||||
╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
</>');
|
||||
$output->writeln('');
|
||||
|
||||
$output->writeln('');
|
||||
$output->writeln('<bg=blue;options=bold> INFO </> Copying <fg=blue;options=bold>PHPFlasher</> resources...');
|
||||
$output->writeln('');
|
||||
|
||||
$publicDir = App::publicPath().'/vendor/flasher/';
|
||||
$exitCode = 0;
|
||||
|
||||
foreach (ServiceProvider::publishableProviders() as $provider) {
|
||||
if (!is_a($provider, 'Flasher\Laravel\Support\ServiceProvider', true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/** @var FlasherServiceProvider $provider */
|
||||
$provider = App::getProvider($provider);
|
||||
$plugin = $provider->createPlugin();
|
||||
$configFile = $provider->getConfigurationFile();
|
||||
|
||||
try {
|
||||
$this->publishAssets($plugin, $publicDir);
|
||||
$this->publishConfig($plugin, $configFile);
|
||||
|
||||
$status = sprintf('<fg=green;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'OK' : "\xE2\x9C\x94" /* HEAVY CHECK MARK (U+2714) */);
|
||||
$output->writeln(sprintf(' %s <fg=blue;options=bold>%s</>', $status, $plugin->getAlias()));
|
||||
} catch (\Exception $e) {
|
||||
$exitCode = 1;
|
||||
$status = sprintf('<fg=red;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */);
|
||||
$output->writeln(sprintf(' %s <fg=blue;options=bold>%s</> <error>%s</error>', $status, $plugin->getAlias(), $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
$output->writeln('');
|
||||
|
||||
if (0 === $exitCode) {
|
||||
$output->writeln('<bg=green;options=bold> SUCCESS </> <fg=blue;options=bold>PHPFlasher</> resources have been successfully installed.');
|
||||
} else {
|
||||
$output->writeln('<bg=red;options=bold> ERROR </> An error occurred during the installation of <fg=blue;options=bold>PHPFlasher</> resources.');
|
||||
}
|
||||
|
||||
$output->writeln('');
|
||||
|
||||
return $exitCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $publicDir
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function publishAssets(PluginInterface $plugin, $publicDir)
|
||||
{
|
||||
$originDir = $plugin->getAssetsDir();
|
||||
|
||||
if (!is_dir($originDir)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$filesystem = new Filesystem();
|
||||
$filesystem->ensureDirectoryExists($originDir, 0777);
|
||||
$filesystem->copyDirectory($originDir, $publicDir);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $configFile
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function publishConfig(PluginInterface $plugin, $configFile)
|
||||
{
|
||||
if (!file_exists($configFile)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$target = App::configPath($plugin->getName().'.php');
|
||||
if (file_exists($target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$filesystem = new Filesystem();
|
||||
$filesystem->copy($configFile, $target);
|
||||
}
|
||||
}
|
23
vendor/php-flasher/flasher-laravel/Component/FlasherComponent.php
vendored
Normal file
23
vendor/php-flasher/flasher-laravel/Component/FlasherComponent.php
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Component;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class FlasherComponent extends Component
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
@trigger_error('Since php-flasher/flasher-laravel v1.6.0: Using flasher blade component is deprecated and will be removed in v2.0. PHPFlasher will render notification automatically', \E_USER_DEPRECATED);
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
21
vendor/php-flasher/flasher-laravel/Container/LaravelContainer.php
vendored
Normal file
21
vendor/php-flasher/flasher-laravel/Container/LaravelContainer.php
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Container;
|
||||
|
||||
use Flasher\Prime\Container\ContainerInterface;
|
||||
|
||||
final class LaravelContainer implements ContainerInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function get($id)
|
||||
{
|
||||
return app()->make($id);
|
||||
}
|
||||
}
|
47
vendor/php-flasher/flasher-laravel/Facade/Flasher.php
vendored
Normal file
47
vendor/php-flasher/flasher-laravel/Facade/Flasher.php
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Facade;
|
||||
|
||||
use Flasher\Prime\Notification\Envelope;
|
||||
use Flasher\Prime\Notification\NotificationBuilder;
|
||||
use Flasher\Prime\Notification\NotificationInterface;
|
||||
use Flasher\Prime\Stamp\StampInterface;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
* @method static NotificationBuilder addSuccess(string $message, array $options = array())
|
||||
* @method static NotificationBuilder addError(string $message, array $options = array())
|
||||
* @method static NotificationBuilder addWarning(string $message, array $options = array())
|
||||
* @method static NotificationBuilder addInfo(string $message, array $options = array())
|
||||
* @method static NotificationBuilder addFlash(NotificationInterface|string $type, string $message = null, array $options = array())
|
||||
* @method static NotificationBuilder flash(StampInterface[] $stamps = array())
|
||||
* @method static NotificationBuilder type(string $type, string $message = null, array $options = array())
|
||||
* @method static NotificationBuilder message(string $message)
|
||||
* @method static NotificationBuilder options(array $options, bool $merge = true)
|
||||
* @method static NotificationBuilder option(string $name, $value)
|
||||
* @method static NotificationBuilder success(string $message = null, array $options = array())
|
||||
* @method static NotificationBuilder error(string $message = null, array $options = array())
|
||||
* @method static NotificationBuilder info(string $message = null, array $options = array())
|
||||
* @method static NotificationBuilder warning(string $message = null, array $options = array())
|
||||
* @method static NotificationBuilder priority(int $priority)
|
||||
* @method static NotificationBuilder hops(int $amount)
|
||||
* @method static NotificationBuilder keep()
|
||||
* @method static NotificationBuilder delay(int $delay)
|
||||
* @method static NotificationBuilder now()
|
||||
* @method static NotificationBuilder with(StampInterface[] $stamps = array())
|
||||
* @method static NotificationBuilder withStamp(StampInterface $stamp)
|
||||
* @method static NotificationBuilder handler(string $handler)
|
||||
* @method static Envelope getEnvelope()
|
||||
*/
|
||||
class Flasher extends Facade
|
||||
{
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'flasher';
|
||||
}
|
||||
}
|
408
vendor/php-flasher/flasher-laravel/FlasherServiceProvider.php
vendored
Normal file
408
vendor/php-flasher/flasher-laravel/FlasherServiceProvider.php
vendored
Normal file
@ -0,0 +1,408 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel;
|
||||
|
||||
use Flasher\Laravel\Container\LaravelContainer;
|
||||
use Flasher\Laravel\Middleware\FlasherMiddleware;
|
||||
use Flasher\Laravel\Middleware\HttpKernelFlasherMiddleware;
|
||||
use Flasher\Laravel\Middleware\HttpKernelSessionMiddleware;
|
||||
use Flasher\Laravel\Middleware\SessionMiddleware;
|
||||
use Flasher\Laravel\Storage\SessionBag;
|
||||
use Flasher\Laravel\Support\Laravel;
|
||||
use Flasher\Laravel\Support\ServiceProvider;
|
||||
use Flasher\Laravel\Template\BladeTemplateEngine;
|
||||
use Flasher\Laravel\Translation\Translator;
|
||||
use Flasher\Prime\Config\Config;
|
||||
use Flasher\Prime\Config\ConfigInterface;
|
||||
use Flasher\Prime\Container\FlasherContainer;
|
||||
use Flasher\Prime\EventDispatcher\EventDispatcher;
|
||||
use Flasher\Prime\EventDispatcher\EventListener\PresetListener;
|
||||
use Flasher\Prime\EventDispatcher\EventListener\TranslationListener;
|
||||
use Flasher\Prime\Flasher;
|
||||
use Flasher\Prime\FlasherInterface;
|
||||
use Flasher\Prime\Http\RequestExtension;
|
||||
use Flasher\Prime\Http\ResponseExtension;
|
||||
use Flasher\Prime\Notification\Envelope;
|
||||
use Flasher\Prime\Plugin\FlasherPlugin;
|
||||
use Flasher\Prime\Response\Resource\ResourceManager;
|
||||
use Flasher\Prime\Response\ResponseManager;
|
||||
use Flasher\Prime\Storage\StorageBag;
|
||||
use Flasher\Prime\Storage\StorageManager;
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Foundation\Http\Kernel;
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Livewire\Component;
|
||||
use Livewire\LivewireManager;
|
||||
use Livewire\Mechanisms\HandleComponents\ComponentContext;
|
||||
use Livewire\Response;
|
||||
|
||||
/**
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
*/
|
||||
final class FlasherServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function afterBoot()
|
||||
{
|
||||
FlasherContainer::init(new LaravelContainer());
|
||||
|
||||
$this->registerCommands();
|
||||
$this->registerBladeDirective();
|
||||
$this->registerBladeComponent();
|
||||
$this->registerLivewire();
|
||||
$this->registerTranslations();
|
||||
$this->registerMiddlewares();
|
||||
}
|
||||
|
||||
/**
|
||||
* @{@inheritdoc}
|
||||
*/
|
||||
public function createPlugin()
|
||||
{
|
||||
return new FlasherPlugin();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function afterRegister()
|
||||
{
|
||||
$this->registerConfig();
|
||||
$this->registerFlasher();
|
||||
$this->registerResourceManager();
|
||||
$this->registerResponseManager();
|
||||
$this->registerStorageManager();
|
||||
$this->registerEventDispatcher();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function registerCommands()
|
||||
{
|
||||
if (!in_array(\PHP_SAPI, array('cli', 'phpdbg'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->commands(array(
|
||||
'Flasher\Laravel\Command\InstallCommand', // flasher:install
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function registerConfig()
|
||||
{
|
||||
$this->app->singleton('flasher.config', function (Application $app) {
|
||||
/** @var Repository $config */
|
||||
$config = $app->make('config');
|
||||
|
||||
return new Config($config->get('flasher', array())); // @phpstan-ignore-line
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function registerFlasher()
|
||||
{
|
||||
$this->app->singleton('flasher', function (Application $app) {
|
||||
$config = $app->make('flasher.config');
|
||||
$responseManager = $app->make('flasher.response_manager');
|
||||
$storageManager = $app->make('flasher.storage_manager');
|
||||
|
||||
return new Flasher($config->get('default'), $responseManager, $storageManager); // @phpstan-ignore-line
|
||||
});
|
||||
$this->app->alias('flasher', 'Flasher\Prime\Flasher');
|
||||
$this->app->bind('Flasher\Prime\FlasherInterface', 'flasher');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function registerResourceManager()
|
||||
{
|
||||
$this->app->singleton('flasher.resource_manager', function (Application $app) {
|
||||
$config = $app->make('flasher.config');
|
||||
$view = $app->make('view');
|
||||
|
||||
return new ResourceManager($config, new BladeTemplateEngine($view)); // @phpstan-ignore-line
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function registerResponseManager()
|
||||
{
|
||||
$this->app->singleton('flasher.response_manager', function (Application $app) {
|
||||
$resourceManager = $app->make('flasher.resource_manager');
|
||||
$storageManager = $app->make('flasher.storage_manager');
|
||||
$eventDispatcher = $app->make('flasher.event_dispatcher');
|
||||
|
||||
return new ResponseManager($resourceManager, $storageManager, $eventDispatcher); // @phpstan-ignore-line
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function registerStorageManager()
|
||||
{
|
||||
$this->app->singleton('flasher.storage_manager', function (Application $app) {
|
||||
$config = $app->make('flasher.config');
|
||||
$eventDispatcher = $app->make('flasher.event_dispatcher');
|
||||
$session = $app->make('session');
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
$storageBag = new StorageBag(new SessionBag($session));
|
||||
|
||||
$criteria = $config->get('filter_criteria', array()); // @phpstan-ignore-line
|
||||
|
||||
return new StorageManager($storageBag, $eventDispatcher, $criteria); // @phpstan-ignore-line
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function registerEventDispatcher()
|
||||
{
|
||||
$this->app->singleton('flasher.event_dispatcher', function (Application $app) {
|
||||
$eventDispatcher = new EventDispatcher();
|
||||
$config = $app->make('flasher.config');
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
$translator = new Translator($app->make('translator'));
|
||||
|
||||
/** @phpstan-ignore-next-line */
|
||||
$autoTranslate = $config->get('auto_translate', true);
|
||||
|
||||
$translatorListener = new TranslationListener($translator, $autoTranslate);
|
||||
$eventDispatcher->addSubscriber($translatorListener);
|
||||
|
||||
$presetListener = new PresetListener($config->get('presets', array())); // @phpstan-ignore-line
|
||||
$eventDispatcher->addSubscriber($presetListener);
|
||||
|
||||
return $eventDispatcher;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function registerTranslations()
|
||||
{
|
||||
/** @var \Illuminate\Translation\Translator $translator */
|
||||
$translator = $this->app->make('translator');
|
||||
$translator->addNamespace('flasher', __DIR__.'/Translation/lang');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function registerLivewire()
|
||||
{
|
||||
if (!$this->app->bound('livewire')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$livewire = $this->app->make('livewire');
|
||||
if (!$livewire instanceof LivewireManager) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Livewire v3
|
||||
if (method_exists($livewire, 'componentHook')) {
|
||||
$livewire->listen('dehydrate', function (Component $component, ComponentContext $context) {
|
||||
if ($context->mounting || isset($context->effects['redirect'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var FlasherInterface $flasher */
|
||||
$flasher = app('flasher');
|
||||
|
||||
/** @var array{envelopes: Envelope[]} $data */
|
||||
$data = $flasher->render(array(), 'array');
|
||||
|
||||
if (\count($data['envelopes']) > 0) {
|
||||
$data['context']['livewire'] = array(
|
||||
'id' => $component->getId(),
|
||||
'name' => $component->getName(),
|
||||
);
|
||||
|
||||
$dispatches = isset($context->effects['dispatches']) ? $context->effects['dispatches'] : [];
|
||||
$dispatches[] = array('name' => 'flasher:render', 'params' => $data);
|
||||
|
||||
$context->addEffect('dispatches', $dispatches);
|
||||
}
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$livewire->listen('component.dehydrate.subsequent', function (Component $component, Response $response) {
|
||||
if (isset($response->effects['redirect'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var FlasherInterface $flasher */
|
||||
$flasher = app('flasher');
|
||||
|
||||
/** @var array{envelopes: Envelope[]} $data */
|
||||
$data = $flasher->render(array(), 'array');
|
||||
|
||||
if (\count($data['envelopes']) > 0) {
|
||||
$data['context']['livewire'] = array(
|
||||
'id' => $component->id,
|
||||
'name' => $response->fingerprint['name'],
|
||||
);
|
||||
|
||||
$response->effects['dispatches'][] = array(
|
||||
'event' => 'flasher:render',
|
||||
'data' => $data,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function registerBladeDirective()
|
||||
{
|
||||
Blade::extend(function ($view) {
|
||||
$pattern = '/(?<!\w)(\s*)@flasher_(livewire_)?render(\(.*?\))?/';
|
||||
|
||||
if (!preg_match($pattern, $view)) {
|
||||
return $view;
|
||||
}
|
||||
|
||||
@trigger_error('Since php-flasher/flasher-laravel v1.6.0: Using @flasher_render or @flasher_livewire_render is deprecated and will be removed in v2.0. PHPFlasher will render notification automatically', \E_USER_DEPRECATED);
|
||||
|
||||
return preg_replace($pattern, '', $view);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function registerBladeComponent()
|
||||
{
|
||||
if (Laravel::isVersion('7.0', '<=')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Blade::component('flasher', 'Flasher\Laravel\Component\FlasherComponent');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function registerMiddlewares()
|
||||
{
|
||||
$this->registerSessionMiddleware();
|
||||
$this->registerFlasherMiddleware();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function registerFlasherMiddleware()
|
||||
{
|
||||
/** @var ConfigInterface $config */
|
||||
$config = $this->app->make('flasher.config');
|
||||
|
||||
if (!$config->get('auto_render', true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->app->singleton('Flasher\Laravel\Middleware\FlasherMiddleware', function (Application $app) {
|
||||
/** @var FlasherInterface $flasher */
|
||||
$flasher = $app->make('flasher');
|
||||
|
||||
return new FlasherMiddleware(new ResponseExtension($flasher));
|
||||
});
|
||||
|
||||
$this->appendMiddlewareToWebGroup('Flasher\Laravel\Middleware\FlasherMiddleware');
|
||||
|
||||
if (method_exists($this->app, 'middleware')) {
|
||||
$this->app->middleware(new HttpKernelFlasherMiddleware($this->app)); // @phpstan-ignore-line
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function registerSessionMiddleware()
|
||||
{
|
||||
/** @var ConfigInterface $config */
|
||||
$config = $this->app->make('flasher.config');
|
||||
|
||||
if (!$config->get('flash_bag.enabled', true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->app->singleton('Flasher\Laravel\Middleware\SessionMiddleware', function (Application $app) {
|
||||
/** @var ConfigInterface $config */
|
||||
$config = $app->make('flasher.config');
|
||||
$mapping = $config->get('flash_bag.mapping', array());
|
||||
$flasher = $app->make('flasher');
|
||||
|
||||
return new SessionMiddleware(new RequestExtension($flasher, $mapping)); // @phpstan-ignore-line
|
||||
});
|
||||
|
||||
$this->appendMiddlewareToWebGroup('Flasher\Laravel\Middleware\SessionMiddleware');
|
||||
|
||||
if (method_exists($this->app, 'middleware')) {
|
||||
$this->app->middleware(new HttpKernelSessionMiddleware($this->app)); // @phpstan-ignore-line
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $middleware
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function appendMiddlewareToWebGroup($middleware)
|
||||
{
|
||||
if (!$this->app->bound($middleware)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var Router $router */
|
||||
$router = $this->app->make('router');
|
||||
if (method_exists($router, 'pushMiddlewareToGroup')) {
|
||||
$router->pushMiddlewareToGroup('web', $middleware);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->app->bound('Illuminate\Contracts\Http\Kernel')) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var Kernel $kernel */
|
||||
$kernel = $this->app->make('Illuminate\Contracts\Http\Kernel');
|
||||
|
||||
if (method_exists($kernel, 'appendMiddlewareToGroup')) {
|
||||
$kernel->appendMiddlewareToGroup('web', $middleware);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (method_exists($kernel, 'pushMiddleware')) {
|
||||
$kernel->pushMiddleware($middleware);
|
||||
}
|
||||
}
|
||||
}
|
78
vendor/php-flasher/flasher-laravel/Http/Request.php
vendored
Normal file
78
vendor/php-flasher/flasher-laravel/Http/Request.php
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Http;
|
||||
|
||||
use Flasher\Prime\Http\RequestInterface;
|
||||
use Illuminate\Http\Request as LaravelRequest;
|
||||
|
||||
final class Request implements RequestInterface
|
||||
{
|
||||
/**
|
||||
* @var LaravelRequest
|
||||
*/
|
||||
private $request;
|
||||
|
||||
public function __construct(LaravelRequest $request)
|
||||
{
|
||||
$this->request = $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function isXmlHttpRequest()
|
||||
{
|
||||
return $this->request->ajax();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function isHtmlRequestFormat()
|
||||
{
|
||||
return 'html' === $this->request->getRequestFormat();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function hasSession()
|
||||
{
|
||||
return $this->request->hasSession();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function hasType($type)
|
||||
{
|
||||
$session = $this->request->session();
|
||||
|
||||
return $session->has($type);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getType($type)
|
||||
{
|
||||
$session = $this->request->session();
|
||||
|
||||
return $session->get($type); // @phpstan-ignore-line
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function forgetType($type)
|
||||
{
|
||||
$session = $this->request->session();
|
||||
|
||||
$session->forget($type);
|
||||
}
|
||||
}
|
90
vendor/php-flasher/flasher-laravel/Http/Response.php
vendored
Normal file
90
vendor/php-flasher/flasher-laravel/Http/Response.php
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Http;
|
||||
|
||||
use Flasher\Prime\Http\ResponseInterface;
|
||||
use Illuminate\Http\JsonResponse as LaravelJsonResponse;
|
||||
use Illuminate\Http\Response as LaravelResponse;
|
||||
|
||||
final class Response implements ResponseInterface
|
||||
{
|
||||
/**
|
||||
* @var LaravelJsonResponse|LaravelResponse
|
||||
*/
|
||||
private $response;
|
||||
|
||||
/**
|
||||
* @param LaravelJsonResponse|LaravelResponse $response
|
||||
*/
|
||||
public function __construct($response)
|
||||
{
|
||||
$this->response = $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function isRedirection()
|
||||
{
|
||||
return $this->response->isRedirection();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function isJson()
|
||||
{
|
||||
return $this->response instanceof LaravelJsonResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function isHtml()
|
||||
{
|
||||
$contentType = $this->response->headers->get('Content-Type');
|
||||
|
||||
return false !== stripos($contentType, 'html'); // @phpstan-ignore-line
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function isAttachment()
|
||||
{
|
||||
$contentDisposition = $this->response->headers->get('Content-Disposition', '');
|
||||
|
||||
return false !== stripos($contentDisposition, 'attachment;'); // @phpstan-ignore-line
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
return $this->response->getContent(); // @phpstan-ignore-line
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
$original = null;
|
||||
if ($this->response instanceof \Illuminate\Http\Response && $this->response->getOriginalContent()) {
|
||||
$original = $this->response->getOriginalContent();
|
||||
}
|
||||
|
||||
$this->response->setContent($content);
|
||||
|
||||
// Restore original response (eg. the View or Ajax data)
|
||||
if ($original) {
|
||||
$this->response->original = $original;
|
||||
}
|
||||
}
|
||||
}
|
21
vendor/php-flasher/flasher-laravel/LICENSE
vendored
Normal file
21
vendor/php-flasher/flasher-laravel/LICENSE
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 PHPFlasher
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
40
vendor/php-flasher/flasher-laravel/Middleware/FlasherMiddleware.php
vendored
Normal file
40
vendor/php-flasher/flasher-laravel/Middleware/FlasherMiddleware.php
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Middleware;
|
||||
|
||||
use Flasher\Laravel\Http\Request;
|
||||
use Flasher\Laravel\Http\Response;
|
||||
use Flasher\Prime\Http\ResponseExtension;
|
||||
use Illuminate\Http\Request as LaravelRequest;
|
||||
use Illuminate\Http\Response as LaravelResponse;
|
||||
|
||||
final class FlasherMiddleware
|
||||
{
|
||||
/**
|
||||
* @var ResponseExtension
|
||||
*/
|
||||
private $responseExtension;
|
||||
|
||||
public function __construct(ResponseExtension $responseExtension)
|
||||
{
|
||||
$this->responseExtension = $responseExtension;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return LaravelResponse
|
||||
*/
|
||||
public function handle(LaravelRequest $request, \Closure $next)
|
||||
{
|
||||
/** @var LaravelResponse $response */
|
||||
$response = $next($request);
|
||||
|
||||
$this->responseExtension->render(new Request($request), new Response($response));
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
40
vendor/php-flasher/flasher-laravel/Middleware/HttpKernelFlasherMiddleware.php
vendored
Normal file
40
vendor/php-flasher/flasher-laravel/Middleware/HttpKernelFlasherMiddleware.php
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Middleware;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
final class HttpKernelFlasherMiddleware implements HttpKernelInterface
|
||||
{
|
||||
/**
|
||||
* @var \Symfony\Component\HttpKernel\HttpKernelInterface
|
||||
*/
|
||||
private $app;
|
||||
|
||||
public function __construct(HttpKernelInterface $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
public function handle(SymfonyRequest $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
|
||||
{
|
||||
$response = $this->app->handle($request, $type, $catch);
|
||||
|
||||
$request = Request::createFromBase($request);
|
||||
$next = function () use ($response) {
|
||||
return $response;
|
||||
};
|
||||
|
||||
/** @var SessionMiddleware $sessionMiddleware */
|
||||
$sessionMiddleware = $this->app->make('Flasher\Laravel\Middleware\FlasherMiddleware');
|
||||
|
||||
return $sessionMiddleware->handle($request, $next);
|
||||
}
|
||||
}
|
40
vendor/php-flasher/flasher-laravel/Middleware/HttpKernelSessionMiddleware.php
vendored
Normal file
40
vendor/php-flasher/flasher-laravel/Middleware/HttpKernelSessionMiddleware.php
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Middleware;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
final class HttpKernelSessionMiddleware implements HttpKernelInterface
|
||||
{
|
||||
/**
|
||||
* @var \Symfony\Component\HttpKernel\HttpKernelInterface
|
||||
*/
|
||||
private $app;
|
||||
|
||||
public function __construct(HttpKernelInterface $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
public function handle(SymfonyRequest $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
|
||||
{
|
||||
$response = $this->app->handle($request, $type, $catch);
|
||||
|
||||
$request = Request::createFromBase($request);
|
||||
$next = function () use ($response) {
|
||||
return $response;
|
||||
};
|
||||
|
||||
/** @var SessionMiddleware $sessionMiddleware */
|
||||
$sessionMiddleware = $this->app->make('Flasher\Laravel\Middleware\SessionMiddleware');
|
||||
|
||||
return $sessionMiddleware->handle($request, $next);
|
||||
}
|
||||
}
|
40
vendor/php-flasher/flasher-laravel/Middleware/SessionMiddleware.php
vendored
Normal file
40
vendor/php-flasher/flasher-laravel/Middleware/SessionMiddleware.php
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Middleware;
|
||||
|
||||
use Flasher\Laravel\Http\Request;
|
||||
use Flasher\Laravel\Http\Response;
|
||||
use Flasher\Prime\Http\RequestExtension;
|
||||
use Illuminate\Http\Request as LaravelRequest;
|
||||
use Illuminate\Http\Response as LaravelResponse;
|
||||
|
||||
final class SessionMiddleware
|
||||
{
|
||||
/**
|
||||
* @var RequestExtension
|
||||
*/
|
||||
private $requestExtension;
|
||||
|
||||
public function __construct(RequestExtension $requestExtension)
|
||||
{
|
||||
$this->requestExtension = $requestExtension;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return LaravelResponse
|
||||
*/
|
||||
public function handle(LaravelRequest $request, \Closure $next)
|
||||
{
|
||||
/** @var LaravelResponse $response */
|
||||
$response = $next($request);
|
||||
|
||||
$this->requestExtension->flash(new Request($request), new Response($response));
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
74
vendor/php-flasher/flasher-laravel/README.md
vendored
Normal file
74
vendor/php-flasher/flasher-laravel/README.md
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
<p align="center">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-github-dark.png">
|
||||
<img src="https://raw.githubusercontent.com/php-flasher/art/main/php-flasher-github.png" alt="PHPFlasher Logo">
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
## About PHPFlasher
|
||||
|
||||
PHPFlasher is a powerful and easy-to-use package that allows you to quickly and easily add flash messages to your Laravel or Symfony projects.
|
||||
Whether you need to alert users of a successful form submission, an error, or any other important information, flash messages are a simple and effective solution for providing feedback to your users.
|
||||
|
||||
With PHPFlasher, you can easily record and store messages within the session, making it simple to retrieve and display them on the current or next page.
|
||||
This improves user engagement and enhances the overall user experience on your website or application.
|
||||
|
||||
Whether you're a beginner or an experienced developer, PHPFlasher's intuitive and straightforward design makes it easy to integrate into your projects.
|
||||
So, if you're looking for a reliable, flexible and easy to use flash messages solution, PHPFlasher is the perfect choice.
|
||||
|
||||
|
||||
## Official Documentation
|
||||
|
||||
Documentation for PHPFlasher can be found on the [https://php-flasher.io](https://php-flasher.io).
|
||||
|
||||
## Contributors and sponsors
|
||||
|
||||
Join our team of contributors and make a lasting impact on our project!
|
||||
|
||||
We are always looking for passionate individuals who want to contribute their skills and ideas.
|
||||
Whether you're a developer, designer, or simply have a great idea, we welcome your participation and collaboration.
|
||||
|
||||
Shining stars of our community:
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-LIST:START -->
|
||||
<!-- prettier-ignore-start -->
|
||||
<!-- markdownlint-disable -->
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/younes-khoubza/"><img src="https://avatars.githubusercontent.com/u/10859693?v=4?s=100" width="100px;" alt="Younes KHOUBZA"/><br /><sub><b>Younes KHOUBZA</b></sub></a><br /><a href="https://github.com/php-flasher/php-flasher/commits?author=yoeunes" title="Code">💻</a> <a href="https://github.com/php-flasher/php-flasher/commits?author=yoeunes" title="Documentation">📖</a> <a href="#maintenance-yoeunes" title="Maintenance">🚧</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/salmayno"><img src="https://avatars.githubusercontent.com/u/27933199?v=4?s=100" width="100px;" alt="Salma Mourad"/><br /><sub><b>Salma Mourad</b></sub></a><br /><a href="#financial-salmayno" title="Financial">💵</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://www.youtube.com/rstacode"><img src="https://avatars.githubusercontent.com/u/35005761?v=4?s=100" width="100px;" alt="Nashwan Abdullah"/><br /><sub><b>Nashwan Abdullah</b></sub></a><br /><a href="#financial-codenashwan" title="Financial">💵</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://darvis.nl/"><img src="https://avatars.githubusercontent.com/u/7394837?v=4?s=100" width="100px;" alt="Arvid de Jong"/><br /><sub><b>Arvid de Jong</b></sub></a><br /><a href="#financial-darviscommerce" title="Financial">💵</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://ashallendesign.co.uk/"><img src="https://avatars.githubusercontent.com/u/39652331?v=4?s=100" width="100px;" alt="Ash Allen"/><br /><sub><b>Ash Allen</b></sub></a><br /><a href="#design-ash-jc-allen" title="Design">🎨</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://about.me/murrant"><img src="https://avatars.githubusercontent.com/u/39462?v=4?s=100" width="100px;" alt="Tony Murray"/><br /><sub><b>Tony Murray</b></sub></a><br /><a href="https://github.com/php-flasher/php-flasher/commits?author=murrant" title="Code">💻</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/n3wborn"><img src="https://avatars.githubusercontent.com/u/10246722?v=4?s=100" width="100px;" alt="Stéphane P"/><br /><sub><b>Stéphane P</b></sub></a><br /><a href="https://github.com/php-flasher/php-flasher/commits?author=n3wborn" title="Documentation">📖</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://www.instagram.com/lucas.maciel_z"><img src="https://avatars.githubusercontent.com/u/80225404?v=4?s=100" width="100px;" alt="Lucas Maciel"/><br /><sub><b>Lucas Maciel</b></sub></a><br /><a href="#design-LucasStorm" title="Design">🎨</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://siek.io/"><img src="https://avatars.githubusercontent.com/u/5730766?v=4?s=100" width="100px;" alt="Antoni Siek"/><br /><sub><b>Antoni Siek</b></sub></a><br /><a href="https://github.com/php-flasher/php-flasher/commits?author=ImJustToNy" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- markdownlint-restore -->
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
## Contact
|
||||
|
||||
PHPFlasher is being actively developed by <a href="https://github.com/yoeunes">yoeunes</a>.
|
||||
You can reach out with questions, bug reports, or feature requests on any of the following:
|
||||
|
||||
- [Github Issues](https://github.com/php-flasher/php-flasher/issues)
|
||||
- [Github](https://github.com/yoeunes)
|
||||
- [Twitter](https://twitter.com/yoeunes)
|
||||
- [Linkedin](https://www.linkedin.com/in/younes-khoubza/)
|
||||
- [Email me directly](mailto:younes.khoubza@gmail.com)
|
||||
|
||||
## License
|
||||
|
||||
PHPFlasher is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
||||
|
||||
<p align="center"> <b>Made with ❤️ by <a href="https://www.linkedin.com/in/younes-khoubza/">Younes KHOUBZA</a> </b> </p>
|
193
vendor/php-flasher/flasher-laravel/Resources/config.php
vendored
Normal file
193
vendor/php-flasher/flasher-laravel/Resources/config.php
vendored
Normal file
@ -0,0 +1,193 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
return array(
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Default PHPFlasher library
|
||||
|---------------------------------------------------------------------------
|
||||
| This option controls the default library that will be used by PHPFlasher
|
||||
| to display notifications in your Laravel application. PHPFlasher supports
|
||||
| several libraries, including "flasher", "toastr", "noty", "notyf",
|
||||
| "sweetalert" and "pnotify".
|
||||
|
|
||||
| The "flasher" library is used by default. If you want to use a different
|
||||
| library, you will need to install it using composer. For example, to use
|
||||
| the "toastr" library, run the following command:
|
||||
| composer require php-flasher/flasher-toastr-laravel
|
||||
|
|
||||
| Here is a list of the supported libraries and the corresponding composer
|
||||
| commands to install them:
|
||||
|
|
||||
| "toastr" : composer require php-flasher/flasher-toastr-laravel
|
||||
| "noty" : composer require php-flasher/flasher-noty-laravel
|
||||
| "notyf" : composer require php-flasher/flasher-notyf-laravel
|
||||
| "sweetalert" : composer require php-flasher/flasher-sweetalert-laravel
|
||||
| "pnotify" : composer require php-flasher/flasher-pnotify-laravel
|
||||
*/
|
||||
'default' => 'flasher',
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Main PHPFlasher javascript file
|
||||
|---------------------------------------------------------------------------
|
||||
| This option specifies the location of the main javascript file that is
|
||||
| required by PHPFlasher to display notifications in your Laravel application.
|
||||
|
|
||||
| By default, PHPFlasher uses a CDN to serve the latest version of the library.
|
||||
| However, you can also choose to download the library locally or install it
|
||||
| using npm.
|
||||
|
|
||||
| To use the local version of the library, run the following command:
|
||||
| php artisan flasher:install
|
||||
|
|
||||
| This will copy the necessary assets to your application's public folder.
|
||||
| You can then specify the local path to the javascript file in the 'local'
|
||||
| field of this option.
|
||||
*/
|
||||
'root_script' => array(
|
||||
'cdn' => 'https://cdn.jsdelivr.net/npm/@flasher/flasher@1.3.2/dist/flasher.min.js',
|
||||
'local' => '/vendor/flasher/flasher.min.js',
|
||||
),
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| PHPFlasher Stylesheet
|
||||
|---------------------------------------------------------------------------
|
||||
| This option specifies the location of the stylesheet file that is
|
||||
| required by PHPFlasher to style the notifications in your Laravel application.
|
||||
|
|
||||
| By default, PHPFlasher uses a CDN to serve the latest version of the stylesheet.
|
||||
| However, you can also choose to download the stylesheet locally or include it
|
||||
| from your assets.
|
||||
|
|
||||
| To use the local version of the stylesheet, make sure you have the necessary
|
||||
| assets in your application's public folder. Then specify the local path to
|
||||
| the stylesheet file in the 'local' field of this option.
|
||||
*/
|
||||
'styles' => array(
|
||||
'cdn' => 'https://cdn.jsdelivr.net/npm/@flasher/flasher@1.3.2/dist/flasher.min.css',
|
||||
'local' => '/vendor/flasher/flasher.min.css',
|
||||
),
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Whether to use CDN for PHPFlasher assets or not
|
||||
|---------------------------------------------------------------------------
|
||||
| This option controls whether PHPFlasher should use CDN links or local assets
|
||||
| for its javascript and CSS files. By default, PHPFlasher uses CDN links
|
||||
| to serve the latest version of the library. However, you can also choose
|
||||
| to use local assets by setting this option to 'false'.
|
||||
|
|
||||
| If you decide to use local assets, don't forget to publish the necessary
|
||||
| files to your application's public folder by running the following command:
|
||||
| php artisan flasher:install
|
||||
|
|
||||
| This will copy the necessary assets to your application's public folder.
|
||||
*/
|
||||
'use_cdn' => true,
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Translate PHPFlasher messages
|
||||
|---------------------------------------------------------------------------
|
||||
| This option controls whether PHPFlasher should pass its messages to the Laravel's
|
||||
| translation service for localization.
|
||||
|
|
||||
| By default, this option is set to 'true', which means that PHPFlasher will
|
||||
| attempt to translate its messages using the translation service.
|
||||
|
|
||||
| If you don't want PHPFlasher to use the Laravel's translation service, you can
|
||||
| set this option to 'false'. In this case, PHPFlasher will use the messages
|
||||
| as-is, without attempting to translate them.
|
||||
*/
|
||||
'auto_translate' => true,
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Inject PHPFlasher in Response
|
||||
|---------------------------------------------------------------------------
|
||||
| This option controls whether PHPFlasher should automatically inject its
|
||||
| javascript and CSS files into the HTML response of your Laravel application.
|
||||
|
|
||||
| By default, this option is set to 'true', which means that PHPFlasher will
|
||||
| listen to the response of your application and automatically insert its
|
||||
| scripts and stylesheets into the HTML before the closing `</body>` tag.
|
||||
|
|
||||
| If you don't want PHPFlasher to automatically inject its scripts and stylesheets
|
||||
| into the response, you can set this option to 'false'. In this case, you will
|
||||
| need to manually include the necessary files in your application's layout.
|
||||
*/
|
||||
'auto_render' => true,
|
||||
|
||||
'flash_bag' => array(
|
||||
/*
|
||||
|-----------------------------------------------------------------------
|
||||
| Enable flash bag
|
||||
|-----------------------------------------------------------------------
|
||||
| This option controls whether PHPFlasher should automatically convert
|
||||
| Laravel's flash messages to PHPFlasher notifications. This feature is
|
||||
| useful when you want to migrate from a legacy system or another
|
||||
| library that uses similar conventions for flash messages.
|
||||
|
|
||||
| When this option is set to 'true', PHPFlasher will check for flash
|
||||
| messages in the session and convert them to notifications using the
|
||||
| mapping specified in the 'mapping' option. When this option is set
|
||||
| to 'false', PHPFlasher will ignore flash messages in the session.
|
||||
*/
|
||||
'enabled' => true,
|
||||
|
||||
/*
|
||||
|-----------------------------------------------------------------------
|
||||
| Flash bag type mapping
|
||||
|-----------------------------------------------------------------------
|
||||
| This option allows you to map or convert session keys to PHPFlasher
|
||||
| notification types. On the left side are the PHPFlasher types.
|
||||
| On the right side are the Laravel session keys that you want to
|
||||
| convert to PHPFlasher types.
|
||||
|
|
||||
| For example, if you want to convert Laravel's 'danger' flash
|
||||
| messages to PHPFlasher's 'error' notifications, you can add
|
||||
| the following entry to the mapping:
|
||||
| 'error' => ['danger'],
|
||||
*/
|
||||
'mapping' => array(
|
||||
'success' => array('success'),
|
||||
'error' => array('error', 'danger'),
|
||||
'warning' => array('warning', 'alarm'),
|
||||
'info' => array('info', 'notice', 'alert'),
|
||||
),
|
||||
),
|
||||
|
||||
/*
|
||||
|---------------------------------------------------------------------------
|
||||
| Global Filter Criteria
|
||||
|---------------------------------------------------------------------------
|
||||
| This option allows you to filter the notifications that are displayed
|
||||
| in your Laravel application. By default, all notifications are displayed,
|
||||
| but you can use this option to limit the number of notifications or
|
||||
| filter them by type.
|
||||
|
|
||||
| For example, to limit the number of notifications to 5, you can set
|
||||
| the 'limit' field to 5:
|
||||
| 'limit' => 5,
|
||||
|
|
||||
| To filter the notifications by type, you can specify an array of
|
||||
| types that you want to display. For example, to only display
|
||||
| error notifications, you can set the 'types' field to ['error']:
|
||||
| 'types' => ['error'],
|
||||
|
|
||||
| You can also combine multiple criteria by specifying multiple fields.
|
||||
| For example, to display up to 5 error notifications, you can set
|
||||
| the 'limit' and 'types' fields like this:
|
||||
| 'limit' => 5,
|
||||
| 'types' => ['error'],
|
||||
*/
|
||||
'filter_criteria' => array(
|
||||
'limit' => 5, // Limit the number of notifications to display
|
||||
),
|
||||
);
|
45
vendor/php-flasher/flasher-laravel/Storage/SessionBag.php
vendored
Normal file
45
vendor/php-flasher/flasher-laravel/Storage/SessionBag.php
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Storage;
|
||||
|
||||
use Flasher\Prime\Storage\Bag\BagInterface;
|
||||
use Illuminate\Session\Store;
|
||||
|
||||
final class SessionBag implements BagInterface
|
||||
{
|
||||
const ENVELOPES_NAMESPACE = 'flasher::envelopes';
|
||||
|
||||
/**
|
||||
* @var Store
|
||||
*/
|
||||
private $session;
|
||||
|
||||
/**
|
||||
* @param Store $session
|
||||
*/
|
||||
public function __construct($session)
|
||||
{
|
||||
$this->session = $session;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
return $this->session->get(self::ENVELOPES_NAMESPACE, array()); // @phpstan-ignore-line
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function set(array $envelopes)
|
||||
{
|
||||
$this->session->put(self::ENVELOPES_NAMESPACE, $envelopes);
|
||||
}
|
||||
}
|
32
vendor/php-flasher/flasher-laravel/Support/Laravel.php
vendored
Normal file
32
vendor/php-flasher/flasher-laravel/Support/Laravel.php
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Support;
|
||||
|
||||
use Illuminate\Foundation\Application;
|
||||
|
||||
final class Laravel
|
||||
{
|
||||
/**
|
||||
* @param string $version
|
||||
* @param string|null $operator
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isVersion($version, $operator = null)
|
||||
{
|
||||
if (null !== $operator) {
|
||||
return version_compare(Application::VERSION, $version, $operator);
|
||||
}
|
||||
|
||||
$parts = explode('.', $version);
|
||||
++$parts[\count($parts) - 1];
|
||||
$next = implode('.', $parts);
|
||||
|
||||
return self::isVersion($version, '>=') && self::isVersion($next, '<');
|
||||
}
|
||||
}
|
228
vendor/php-flasher/flasher-laravel/Support/ServiceProvider.php
vendored
Normal file
228
vendor/php-flasher/flasher-laravel/Support/ServiceProvider.php
vendored
Normal file
@ -0,0 +1,228 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Support;
|
||||
|
||||
use Flasher\Prime\FlasherInterface;
|
||||
use Flasher\Prime\Plugin\PluginInterface;
|
||||
use Flasher\Prime\Response\Resource\ResourceManagerInterface;
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Contracts\Config\Repository;
|
||||
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
|
||||
|
||||
abstract class ServiceProvider extends BaseServiceProvider
|
||||
{
|
||||
/**
|
||||
* @var PluginInterface|null
|
||||
*/
|
||||
protected $plugin;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->plugin = $this->plugin ?: $this->createPlugin();
|
||||
|
||||
$this->processConfiguration();
|
||||
$this->afterRegister();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerPublishing();
|
||||
$this->registerFactory();
|
||||
$this->afterBoot();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PluginInterface
|
||||
*/
|
||||
abstract public function createPlugin();
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getConfigurationFile()
|
||||
{
|
||||
return rtrim($this->getResourcesDir(), '/').'/config.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function registerPublishing()
|
||||
{
|
||||
if (!in_array(\PHP_SAPI, array('cli', 'phpdbg'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Laravel::isVersion('4')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->publishConfiguration();
|
||||
$this->publishAssets();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function publishConfiguration()
|
||||
{
|
||||
if (null === $this->plugin) {
|
||||
return;
|
||||
}
|
||||
|
||||
$file = $this->getConfigurationFile();
|
||||
if (!file_exists($file)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$paths = array($file => config_path($this->plugin->getName().'.php'));
|
||||
|
||||
$this->publishes($paths);
|
||||
|
||||
$groups = array(
|
||||
'flasher-config',
|
||||
str_replace('_', '-', $this->plugin->getName()).'-config',
|
||||
);
|
||||
|
||||
foreach ($groups as $group) {
|
||||
if (!array_key_exists($group, static::$publishGroups)) {
|
||||
static::$publishGroups[$group] = array();
|
||||
}
|
||||
|
||||
static::$publishGroups[$group] = array_merge(static::$publishGroups[$group], $paths);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function publishAssets()
|
||||
{
|
||||
if (null === $this->plugin) {
|
||||
return;
|
||||
}
|
||||
|
||||
$dir = $this->plugin->getAssetsDir();
|
||||
|
||||
if (!is_dir($dir)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$paths = array($dir => public_path('vendor/flasher/'));
|
||||
|
||||
$this->publishes($paths);
|
||||
|
||||
$groups = array(
|
||||
'flasher-assets',
|
||||
str_replace('_', '-', $this->plugin->getName()).'-assets',
|
||||
);
|
||||
|
||||
foreach ($groups as $group) {
|
||||
if (!array_key_exists($group, static::$publishGroups)) {
|
||||
static::$publishGroups[$group] = array();
|
||||
}
|
||||
|
||||
static::$publishGroups[$group] = array_merge(static::$publishGroups[$group], $paths);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function getResourcesDir()
|
||||
{
|
||||
$r = new \ReflectionClass($this);
|
||||
|
||||
return pathinfo($r->getFileName() ?: '', PATHINFO_DIRNAME).'/Resources/';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function processConfiguration()
|
||||
{
|
||||
if (null === $this->plugin) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var Repository $config */
|
||||
$config = $this->app->make('config');
|
||||
|
||||
$name = $this->plugin->getName();
|
||||
|
||||
/** @var array<string, mixed> $configuration */
|
||||
$configuration = $config->get($name, array());
|
||||
|
||||
$config->set($name, $this->plugin->processConfiguration($configuration));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function afterRegister()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function afterBoot()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function registerFactory()
|
||||
{
|
||||
$plugin = $this->plugin;
|
||||
if (null === $plugin) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!class_exists($plugin->getFactory())) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->app->singleton($plugin->getServiceID(), function (Container $app) use ($plugin) {
|
||||
$factory = $plugin->getFactory();
|
||||
|
||||
return new $factory($app->make('flasher.storage_manager'));
|
||||
});
|
||||
|
||||
$this->app->alias($plugin->getServiceID(), $plugin->getFactory());
|
||||
|
||||
$this->app->extend('flasher', function (FlasherInterface $flasher, Container $app) use ($plugin) {
|
||||
$flasher->addFactory($plugin->getAlias(), $app->make($plugin->getServiceID())); // @phpstan-ignore-line
|
||||
|
||||
return $flasher;
|
||||
});
|
||||
|
||||
$config = $this->app->make('config')->get($this->plugin->getName(), array()); // @phpstan-ignore-line
|
||||
$this->app->extend('flasher.resource_manager', function (ResourceManagerInterface $manager) use ($plugin, $config) {
|
||||
$config = $plugin->normalizeConfig($config);
|
||||
|
||||
$scripts = isset($config['scripts']) ? $config['scripts'] : array();
|
||||
$manager->addScripts($plugin->getAlias(), $scripts);
|
||||
|
||||
$styles = isset($config['styles']) ? $config['styles'] : array();
|
||||
$manager->addStyles($plugin->getAlias(), $styles);
|
||||
|
||||
$options = isset($config['options']) ? $config['options'] : array();
|
||||
$manager->addOptions($plugin->getAlias(), $options);
|
||||
|
||||
return $manager;
|
||||
});
|
||||
}
|
||||
}
|
34
vendor/php-flasher/flasher-laravel/Template/BladeTemplateEngine.php
vendored
Normal file
34
vendor/php-flasher/flasher-laravel/Template/BladeTemplateEngine.php
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Template;
|
||||
|
||||
use Flasher\Prime\Template\TemplateEngineInterface;
|
||||
use Illuminate\View\Factory;
|
||||
|
||||
final class BladeTemplateEngine implements TemplateEngineInterface
|
||||
{
|
||||
/**
|
||||
* @var Factory
|
||||
*/
|
||||
private $engine;
|
||||
|
||||
/**
|
||||
* @param Factory $engine
|
||||
*/
|
||||
public function __construct($engine)
|
||||
{
|
||||
$this->engine = $engine;
|
||||
}
|
||||
|
||||
public function render($name, array $context = array())
|
||||
{
|
||||
$view = $this->engine->make($name, $context);
|
||||
|
||||
return $view->render();
|
||||
}
|
||||
}
|
55
vendor/php-flasher/flasher-laravel/Translation/Translator.php
vendored
Normal file
55
vendor/php-flasher/flasher-laravel/Translation/Translator.php
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
namespace Flasher\Laravel\Translation;
|
||||
|
||||
use Flasher\Prime\Stamp\TranslationStamp;
|
||||
use Flasher\Prime\Translation\TranslatorInterface;
|
||||
use Illuminate\Translation\Translator as LaravelTranslator;
|
||||
|
||||
final class Translator implements TranslatorInterface
|
||||
{
|
||||
/**
|
||||
* @var LaravelTranslator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
public function __construct(LaravelTranslator $translator)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function translate($id, $parameters = array(), $locale = null)
|
||||
{
|
||||
$order = TranslationStamp::parametersOrder($parameters, $locale);
|
||||
$parameters = $order['parameters'];
|
||||
$locale = $order['locale'];
|
||||
|
||||
$translation = $this->translator->has('flasher::messages.'.$id, $locale)
|
||||
? $this->translator->get('flasher::messages.'.$id, $parameters, $locale)
|
||||
: ($this->translator->has('messages.'.$id, $locale)
|
||||
? $this->translator->get('messages.'.$id, $parameters, $locale)
|
||||
: $this->translator->get($id, $parameters, $locale));
|
||||
|
||||
if (!\is_string($translation)) {
|
||||
return $id;
|
||||
}
|
||||
|
||||
return $translation;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->translator->getLocale();
|
||||
}
|
||||
}
|
10
vendor/php-flasher/flasher-laravel/Translation/lang/ar/messages.php
vendored
Normal file
10
vendor/php-flasher/flasher-laravel/Translation/lang/ar/messages.php
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
use Flasher\Prime\Translation\Messages;
|
||||
|
||||
return Messages::$ar;
|
10
vendor/php-flasher/flasher-laravel/Translation/lang/en/messages.php
vendored
Normal file
10
vendor/php-flasher/flasher-laravel/Translation/lang/en/messages.php
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
use Flasher\Prime\Translation\Messages;
|
||||
|
||||
return Messages::$en;
|
10
vendor/php-flasher/flasher-laravel/Translation/lang/fr/messages.php
vendored
Normal file
10
vendor/php-flasher/flasher-laravel/Translation/lang/fr/messages.php
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the PHPFlasher package.
|
||||
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
||||
*/
|
||||
|
||||
use Flasher\Prime\Translation\Messages;
|
||||
|
||||
return Messages::$fr;
|
64
vendor/php-flasher/flasher-laravel/composer.json
vendored
Normal file
64
vendor/php-flasher/flasher-laravel/composer.json
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
{
|
||||
"name": "php-flasher/flasher-laravel",
|
||||
"description": "PHPFlasher - A powerful & easy-to-use package for adding flash messages to Laravel or Symfony projects. Provides feedback to users, improves engagement & enhances user experience. Intuitive design for beginners & experienced developers. A reliable, flexible solution.",
|
||||
"license": "MIT",
|
||||
"type": "library",
|
||||
"keywords": [
|
||||
"php-flasher",
|
||||
"flash-messages",
|
||||
"notification-system",
|
||||
"user-feedback",
|
||||
"toastr",
|
||||
"sweetalert",
|
||||
"pnotify",
|
||||
"noty",
|
||||
"notyf",
|
||||
"desktop-notifications",
|
||||
"php",
|
||||
"laravel",
|
||||
"symfony",
|
||||
"javascript",
|
||||
"yoeunes",
|
||||
"framework-agnostic",
|
||||
"phpstorm-auto-complete",
|
||||
"custom-adapter",
|
||||
"user-experience",
|
||||
"rtl",
|
||||
"dark-mode"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Younes KHOUBZA",
|
||||
"email": "younes.khoubza@gmail.com",
|
||||
"homepage": "https://www.linkedin.com/in/younes-khoubza",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"homepage": "https://php-flasher.io",
|
||||
"require": {
|
||||
"php": ">=5.3",
|
||||
"illuminate/support": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0",
|
||||
"php-flasher/flasher": "^1.15.14"
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true,
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Flasher\\Laravel\\": ""
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"aliases": {
|
||||
"Flasher": "Flasher\\Laravel\\Facade\\Flasher"
|
||||
},
|
||||
"providers": [
|
||||
"Flasher\\Laravel\\FlasherServiceProvider"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user