From ea3ab21beb876bf5db60a412d789289e05e64535 Mon Sep 17 00:00:00 2001 From: Nabeel S Date: Wed, 20 Nov 2019 10:16:01 -0500 Subject: [PATCH 001/172] 391 Notification refactorings (#441) * Refactor notifications to allow easier plugins * Notification refactoring * Formatting * Move news to NewsService; cleanup of events * More refactoring; added send email out for news item and the template * Formatting * Formatting --- app/Bootstrap/LoadConfiguration.php | 6 +- app/Contracts/Award.php | 13 +-- app/Contracts/Listener.php | 18 +++- app/Database/seeds/dev/sample.yml | 2 +- app/Database/seeds/settings.yml | 14 ++++ app/Events/BaseEvent.php | 12 +++ app/Events/CronHourly.php | 16 +--- app/Events/CronMonthly.php | 13 +-- app/Events/CronNightly.php | 13 +-- app/Events/CronWeekly.php | 10 +-- app/Events/Expenses.php | 5 +- app/Events/NewsAdded.php | 15 ++++ app/Events/PirepAccepted.php | 15 +--- app/Events/PirepFiled.php | 6 +- app/Events/PirepRejected.php | 15 +--- app/Events/TestEvent.php | 15 +--- app/Events/UserAccepted.php | 15 +--- app/Events/UserRegistered.php | 15 +--- app/Events/UserStateChanged.php | 13 +-- app/Events/UserStatsChanged.php | 16 +--- .../Controllers/Admin/DashboardController.php | 16 ++-- .../{BidEvents.php => BidEventHandler.php} | 28 ++++--- app/Listeners/ExpenseListener.php | 3 - ...anceEvents.php => FinanceEventHandler.php} | 32 ++----- ...etUserActive.php => UserStateListener.php} | 2 +- app/Models/News.php | 4 + app/Notifications/Admin/UserRegistered.php | 61 -------------- app/Notifications/BaseNotification.php | 41 +++++++++ app/Notifications/Channels/MailChannel.php | 41 +++++++++ .../EventHandler.php} | 83 +++++++++++++------ .../Messages/AdminUserRegistered.php | 38 +++++++++ app/Notifications/Messages/NewsAdded.php | 40 +++++++++ app/Notifications/Messages/PirepAccepted.php | 50 +++++++++++ app/Notifications/Messages/PirepRejected.php | 47 +++++++++++ app/Notifications/Messages/PirepSubmitted.php | 47 +++++++++++ app/Notifications/Messages/UserPending.php | 42 ++++++++++ app/Notifications/Messages/UserRegistered.php | 39 +++++++++ app/Notifications/Messages/UserRejected.php | 44 ++++++++++ .../{ => Notifiables}/Backups.php | 2 +- app/Notifications/Notifiables/Broadcast.php | 25 ++++++ app/Notifications/PirepAccepted.php | 68 --------------- app/Notifications/PirepRejected.php | 68 --------------- app/Notifications/PirepSubmitted.php | 68 --------------- app/Notifications/UserPending.php | 65 --------------- app/Notifications/UserRegistered.php | 60 -------------- app/Notifications/UserRejected.php | 65 --------------- app/Providers/EventServiceProvider.php | 16 ++-- app/Services/AwardService.php | 9 +- app/Services/NewsService.php | 44 ++++++++++ config/backup.php | 2 +- config/notifications.php | 26 ++++++ modules/.gitignore | 1 + .../Awards}/Awards/PilotFlightAwards.php | 6 +- modules/Awards/module.json | 12 +++ .../mail/admin/pirep/submitted.blade.php | 0 .../mail/admin/user/registered.blade.php | 0 .../notifications/mail/news/news.blade.php | 12 +++ .../mail/pirep/accepted.blade.php | 0 .../mail/pirep/rejected.blade.php | 0 .../mail/user/new_login_details.blade.php | 0 .../mail/user/pending.blade.php | 0 .../mail/user/registered.blade.php | 0 .../mail/user/rejected.blade.php | 0 tests/AwardsTest.php | 2 +- tests/PIREPTest.php | 6 +- tests/TestCase.php | 4 +- 66 files changed, 751 insertions(+), 715 deletions(-) create mode 100644 app/Events/BaseEvent.php create mode 100644 app/Events/NewsAdded.php rename app/Listeners/{BidEvents.php => BidEventHandler.php} (57%) rename app/Listeners/{FinanceEvents.php => FinanceEventHandler.php} (65%) rename app/Listeners/{SetUserActive.php => UserStateListener.php} (93%) delete mode 100644 app/Notifications/Admin/UserRegistered.php create mode 100644 app/Notifications/BaseNotification.php create mode 100644 app/Notifications/Channels/MailChannel.php rename app/{Listeners/NotificationEvents.php => Notifications/EventHandler.php} (60%) create mode 100644 app/Notifications/Messages/AdminUserRegistered.php create mode 100644 app/Notifications/Messages/NewsAdded.php create mode 100644 app/Notifications/Messages/PirepAccepted.php create mode 100644 app/Notifications/Messages/PirepRejected.php create mode 100644 app/Notifications/Messages/PirepSubmitted.php create mode 100644 app/Notifications/Messages/UserPending.php create mode 100644 app/Notifications/Messages/UserRegistered.php create mode 100644 app/Notifications/Messages/UserRejected.php rename app/Notifications/{ => Notifiables}/Backups.php (90%) create mode 100644 app/Notifications/Notifiables/Broadcast.php delete mode 100644 app/Notifications/PirepAccepted.php delete mode 100644 app/Notifications/PirepRejected.php delete mode 100644 app/Notifications/PirepSubmitted.php delete mode 100644 app/Notifications/UserPending.php delete mode 100644 app/Notifications/UserRegistered.php delete mode 100644 app/Notifications/UserRejected.php create mode 100644 app/Services/NewsService.php create mode 100644 config/notifications.php rename {app => modules/Awards}/Awards/PilotFlightAwards.php (88%) create mode 100644 modules/Awards/module.json rename resources/views/{ => notifications}/mail/admin/pirep/submitted.blade.php (100%) rename resources/views/{ => notifications}/mail/admin/user/registered.blade.php (100%) create mode 100644 resources/views/notifications/mail/news/news.blade.php rename resources/views/{ => notifications}/mail/pirep/accepted.blade.php (100%) rename resources/views/{ => notifications}/mail/pirep/rejected.blade.php (100%) rename resources/views/{ => notifications}/mail/user/new_login_details.blade.php (100%) rename resources/views/{ => notifications}/mail/user/pending.blade.php (100%) rename resources/views/{ => notifications}/mail/user/registered.blade.php (100%) rename resources/views/{ => notifications}/mail/user/rejected.blade.php (100%) diff --git a/app/Bootstrap/LoadConfiguration.php b/app/Bootstrap/LoadConfiguration.php index 76782c772..9f76daabb 100644 --- a/app/Bootstrap/LoadConfiguration.php +++ b/app/Bootstrap/LoadConfiguration.php @@ -5,13 +5,11 @@ use Illuminate\Contracts\Config\Repository as RepositoryContract; use Illuminate\Contracts\Foundation\Application; -/** - * Class LoadConfiguration - */ class LoadConfiguration extends \Illuminate\Foundation\Bootstrap\LoadConfiguration { /** - * Load the configuration items from all of the files. + * Load the configuration items from all of the files. This reads the config.php from + * that's sitting in the root, and then recursively merges it with the current configs * * @param \Illuminate\Contracts\Foundation\Application $app * @param \Illuminate\Contracts\Config\Repository $repository diff --git a/app/Contracts/Award.php b/app/Contracts/Award.php index d30732c85..36c382e28 100644 --- a/app/Contracts/Award.php +++ b/app/Contracts/Award.php @@ -6,7 +6,8 @@ use App\Models\Award as AwardModel; use App\Models\User; use App\Models\UserAward; -use Log; +use Exception; +use Illuminate\Support\Facades\Log; /** * Base class for the Awards, you need to extend this, and implement: @@ -38,12 +39,6 @@ abstract public function check($parameter = null): bool; protected $award; protected $user; - /** - * AwardInterface constructor. - * - * @param AwardModel $award - * @param User $user - */ public function __construct(AwardModel $award = null, User $user = null) { $this->award = $award; @@ -73,7 +68,7 @@ final public function handle(): void * * @return bool|UserAward */ - final protected function addAward() + protected function addAward() { $w = [ 'user_id' => $this->user->id, @@ -90,7 +85,7 @@ final protected function addAward() try { $award->save(); - } catch (\Exception $e) { + } catch (Exception $e) { Log::error( 'Error saving award: '.$e->getMessage(), $e->getTrace() diff --git a/app/Contracts/Listener.php b/app/Contracts/Listener.php index 7ce6f8a6d..9245d0449 100644 --- a/app/Contracts/Listener.php +++ b/app/Contracts/Listener.php @@ -2,9 +2,21 @@ namespace App\Contracts; -/** - * Class Listener - */ +use Illuminate\Contracts\Events\Dispatcher; + abstract class Listener { + public static $callbacks = []; + + /** + * Sets up any callbacks that are defined in the child class + * + * @param $events + */ + public function subscribe(Dispatcher $events): void + { + foreach (static::$callbacks as $klass => $cb) { + $events->listen($klass, get_class($this).'@'.$cb); + } + } } diff --git a/app/Database/seeds/dev/sample.yml b/app/Database/seeds/dev/sample.yml index 2edc9e584..6f6dcb500 100644 --- a/app/Database/seeds/dev/sample.yml +++ b/app/Database/seeds/dev/sample.yml @@ -20,7 +20,7 @@ awards: name: Pilot 50 flights description: When a pilot has 50 flights, give this award image_url: - ref_model: App\Awards\PilotFlightAwards + ref_model: Modules\Awards\Awards\PilotFlightAwards ref_model_params: 50 created_at: now updated_at: now diff --git a/app/Database/seeds/settings.yml b/app/Database/seeds/settings.yml index 9b58b44f4..9ba00020d 100644 --- a/app/Database/seeds/settings.yml +++ b/app/Database/seeds/settings.yml @@ -222,3 +222,17 @@ options: '' type: boolean description: 'Count transfer hours in calculations, like ranks and the total hours' +- key: notifications.discord_api_key + name: Discord API token + group: notifications + value: '' + options: '' + type: text + description: Discord API token for notifications +- key: 'notifications.discord_public_channel_id' + name: 'Discord Public Channel ID' + group: 'notifications' + value: '' + options: '' + type: 'text' + description: 'Discord public channel ID for broadcasat notifications' diff --git a/app/Events/BaseEvent.php b/app/Events/BaseEvent.php new file mode 100644 index 000000000..1a7b0b504 --- /dev/null +++ b/app/Events/BaseEvent.php @@ -0,0 +1,12 @@ +news = $news; + } +} diff --git a/app/Events/PirepAccepted.php b/app/Events/PirepAccepted.php index 988a377f8..7619d721a 100644 --- a/app/Events/PirepAccepted.php +++ b/app/Events/PirepAccepted.php @@ -3,24 +3,11 @@ namespace App\Events; use App\Models\Pirep; -use Illuminate\Broadcasting\InteractsWithSockets; -use Illuminate\Foundation\Events\Dispatchable; -use Illuminate\Queue\SerializesModels; -/** - * Class PirepAccepted - */ -class PirepAccepted +class PirepAccepted extends BaseEvent { - use Dispatchable, InteractsWithSockets, SerializesModels; - public $pirep; - /** - * PirepAccepted constructor. - * - * @param Pirep $pirep - */ public function __construct(Pirep $pirep) { $this->pirep = $pirep; diff --git a/app/Events/PirepFiled.php b/app/Events/PirepFiled.php index 560b0ca6c..b9f6a3e64 100644 --- a/app/Events/PirepFiled.php +++ b/app/Events/PirepFiled.php @@ -3,13 +3,9 @@ namespace App\Events; use App\Models\Pirep; -use Illuminate\Broadcasting\InteractsWithSockets; -use Illuminate\Foundation\Events\Dispatchable; -use Illuminate\Queue\SerializesModels; -class PirepFiled +class PirepFiled extends BaseEvent { - use Dispatchable, InteractsWithSockets, SerializesModels; public $pirep; public function __construct(Pirep $pirep) diff --git a/app/Events/PirepRejected.php b/app/Events/PirepRejected.php index 66e421cec..1d78e1eb5 100644 --- a/app/Events/PirepRejected.php +++ b/app/Events/PirepRejected.php @@ -3,24 +3,11 @@ namespace App\Events; use App\Models\Pirep; -use Illuminate\Broadcasting\InteractsWithSockets; -use Illuminate\Foundation\Events\Dispatchable; -use Illuminate\Queue\SerializesModels; -/** - * Class PirepRejected - */ -class PirepRejected +class PirepRejected extends BaseEvent { - use Dispatchable, InteractsWithSockets, SerializesModels; - public $pirep; - /** - * PirepRejected constructor. - * - * @param Pirep $pirep - */ public function __construct(Pirep $pirep) { $this->pirep = $pirep; diff --git a/app/Events/TestEvent.php b/app/Events/TestEvent.php index f5781047e..27cb623ed 100644 --- a/app/Events/TestEvent.php +++ b/app/Events/TestEvent.php @@ -3,24 +3,11 @@ namespace App\Events; use App\Models\User; -use Illuminate\Broadcasting\InteractsWithSockets; -use Illuminate\Foundation\Events\Dispatchable; -use Illuminate\Queue\SerializesModels; -/** - * Class TestEvent - */ -class TestEvent +class TestEvent extends BaseEvent { - use Dispatchable, InteractsWithSockets, SerializesModels; - public $user; - /** - * Create a new event instance. - * - * @param User $user - */ public function __construct(User $user) { $this->user = $user; diff --git a/app/Events/UserAccepted.php b/app/Events/UserAccepted.php index 21de3f70b..738188d81 100644 --- a/app/Events/UserAccepted.php +++ b/app/Events/UserAccepted.php @@ -3,24 +3,11 @@ namespace App\Events; use App\Models\User; -use Illuminate\Broadcasting\InteractsWithSockets; -use Illuminate\Foundation\Events\Dispatchable; -use Illuminate\Queue\SerializesModels; -/** - * Class UserAccepted - */ -class UserAccepted +class UserAccepted extends BaseEvent { - use Dispatchable, InteractsWithSockets, SerializesModels; - public $user; - /** - * UserAccepted constructor. - * - * @param User $user - */ public function __construct(User $user) { $this->user = $user; diff --git a/app/Events/UserRegistered.php b/app/Events/UserRegistered.php index f2c501b20..7bf622f7a 100644 --- a/app/Events/UserRegistered.php +++ b/app/Events/UserRegistered.php @@ -3,24 +3,11 @@ namespace App\Events; use App\Models\User; -use Illuminate\Broadcasting\InteractsWithSockets; -use Illuminate\Foundation\Events\Dispatchable; -use Illuminate\Queue\SerializesModels; -/** - * Class UserRegistered - */ -class UserRegistered +class UserRegistered extends BaseEvent { - use Dispatchable, InteractsWithSockets, SerializesModels; - public $user; - /** - * UserRegistered constructor. - * - * @param User $user - */ public function __construct(User $user) { $this->user = $user; diff --git a/app/Events/UserStateChanged.php b/app/Events/UserStateChanged.php index 4d686dc18..34291ae2d 100644 --- a/app/Events/UserStateChanged.php +++ b/app/Events/UserStateChanged.php @@ -3,26 +3,15 @@ namespace App\Events; use App\Models\User; -use Illuminate\Broadcasting\InteractsWithSockets; -use Illuminate\Foundation\Events\Dispatchable; -use Illuminate\Queue\SerializesModels; /** * Event triggered when a user's state changes */ -class UserStateChanged +class UserStateChanged extends BaseEvent { - use Dispatchable, InteractsWithSockets, SerializesModels; - public $old_state; public $user; - /** - * UserStateChanged constructor. - * - * @param User $user - * @param $old_state - */ public function __construct(User $user, $old_state) { $this->old_state = $old_state; diff --git a/app/Events/UserStatsChanged.php b/app/Events/UserStatsChanged.php index 075a91561..211efcd51 100644 --- a/app/Events/UserStatsChanged.php +++ b/app/Events/UserStatsChanged.php @@ -3,26 +3,18 @@ namespace App\Events; use App\Models\User; -use Illuminate\Broadcasting\InteractsWithSockets; -use Illuminate\Foundation\Events\Dispatchable; -use Illuminate\Queue\SerializesModels; -/** - * Class UserStatsChanged - */ -class UserStatsChanged +class UserStatsChanged extends BaseEvent { - use Dispatchable, InteractsWithSockets, SerializesModels; - public $stat_name; public $old_value; public $user; /* * When a user's stats change. Stats changed match the field name: - * airport - * flights - * rank + * airport + * flights + * rank */ public function __construct(User $user, $stat_name, $old_value) { diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php index 9d5a0fb7e..81b007cef 100644 --- a/app/Http/Controllers/Admin/DashboardController.php +++ b/app/Http/Controllers/Admin/DashboardController.php @@ -4,9 +4,9 @@ use App\Contracts\Controller; use App\Repositories\KvpRepository; -use App\Repositories\NewsRepository; use App\Repositories\PirepRepository; use App\Repositories\UserRepository; +use App\Services\NewsService; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Log; @@ -15,7 +15,7 @@ class DashboardController extends Controller { private $kvpRepo; - private $newsRepo; + private $newsSvc; private $pirepRepo; private $userRepo; @@ -23,20 +23,20 @@ class DashboardController extends Controller * DashboardController constructor. * * @param KvpRepository $kvpRepo - * @param NewsRepository $newsRepo * @param PirepRepository $pirepRepo * @param UserRepository $userRepo + * @param $newsSvc */ public function __construct( KvpRepository $kvpRepo, - NewsRepository $newsRepo, + NewsService $newsSvc, PirepRepository $pirepRepo, UserRepository $userRepo ) { $this->kvpRepo = $kvpRepo; - $this->newsRepo = $newsRepo; $this->pirepRepo = $pirepRepo; $this->userRepo = $userRepo; + $this->newsSvc = $newsSvc; } /** @@ -93,10 +93,10 @@ public function news(Request $request) $attrs = $request->post(); $attrs['user_id'] = Auth::user()->id; - $this->newsRepo->create($attrs); + $this->newsSvc->addNews($attrs); } elseif ($request->isMethod('delete')) { - $news_id = $request->input('news_id'); - $this->newsRepo->delete($news_id); + $id = $request->input('news_id'); + $this->newsSvc->deleteNews($id); } return view('admin.dashboard.news', [ diff --git a/app/Listeners/BidEvents.php b/app/Listeners/BidEventHandler.php similarity index 57% rename from app/Listeners/BidEvents.php rename to app/Listeners/BidEventHandler.php index 2aed462d3..fff8affa5 100644 --- a/app/Listeners/BidEvents.php +++ b/app/Listeners/BidEventHandler.php @@ -4,14 +4,19 @@ use App\Contracts\Listener; use App\Events\PirepAccepted; +use App\Events\PirepRejected; use App\Services\BidService; -use Illuminate\Contracts\Events\Dispatcher; /** * Do stuff with bids - like if a PIREP is accepted, then remove the bid */ -class BidEvents extends Listener +class BidEventHandler extends Listener { + public static $callbacks = [ + PirepAccepted::class => 'onPirepAccept', + PirepRejected::class => 'onPirepReject', + ]; + private $bidSvc; public function __construct(BidService $bidSvc) @@ -20,26 +25,29 @@ public function __construct(BidService $bidSvc) } /** - * @param $events + * When a PIREP is accepted, remove any bids + * + * @param PirepAccepted $event + * + * @throws \UnexpectedValueException + * @throws \InvalidArgumentException + * @throws \Exception */ - public function subscribe(Dispatcher $events): void + public function onPirepAccept(PirepAccepted $event): void { - $events->listen( - PirepAccepted::class, - 'App\Listeners\BidEvents@onPirepAccept' - ); + $this->bidSvc->removeBidForPirep($event->pirep); } /** * When a PIREP is accepted, remove any bids * - * @param PirepAccepted $event + * @param PirepRejected $event * * @throws \UnexpectedValueException * @throws \InvalidArgumentException * @throws \Exception */ - public function onPirepAccept(PirepAccepted $event): void + public function onPirepReject(PirepRejected $event): void { $this->bidSvc->removeBidForPirep($event->pirep); } diff --git a/app/Listeners/ExpenseListener.php b/app/Listeners/ExpenseListener.php index 3329839a0..3de6c596e 100644 --- a/app/Listeners/ExpenseListener.php +++ b/app/Listeners/ExpenseListener.php @@ -5,9 +5,6 @@ use App\Contracts\Listener; use App\Events\Expenses; -/** - * Class ExpenseListener - */ class ExpenseListener extends Listener { /** diff --git a/app/Listeners/FinanceEvents.php b/app/Listeners/FinanceEventHandler.php similarity index 65% rename from app/Listeners/FinanceEvents.php rename to app/Listeners/FinanceEventHandler.php index 61548cd2b..a3549bcb9 100644 --- a/app/Listeners/FinanceEvents.php +++ b/app/Listeners/FinanceEventHandler.php @@ -6,41 +6,23 @@ use App\Events\PirepAccepted; use App\Events\PirepRejected; use App\Services\Finance\PirepFinanceService; -use Illuminate\Contracts\Events\Dispatcher; /** * Subscribe for events that we do some financial processing for * This includes when a PIREP is accepted, or rejected */ -class FinanceEvents extends Listener +class FinanceEventHandler extends Listener { private $financeSvc; - /** - * FinanceEvents constructor. - * - * @param PirepFinanceService $financeSvc - */ - public function __construct( - PirepFinanceService $financeSvc - ) { - $this->financeSvc = $financeSvc; - } + public static $callbacks = [ + PirepAccepted::class => 'onPirepAccept', + PirepRejected::class => 'onPirepReject', + ]; - /** - * @param $events - */ - public function subscribe(Dispatcher $events): void + public function __construct(PirepFinanceService $financeSvc) { - $events->listen( - PirepAccepted::class, - 'App\Listeners\FinanceEvents@onPirepAccept' - ); - - $events->listen( - PirepRejected::class, - 'App\Listeners\FinanceEvents@onPirepReject' - ); + $this->financeSvc = $financeSvc; } /** diff --git a/app/Listeners/SetUserActive.php b/app/Listeners/UserStateListener.php similarity index 93% rename from app/Listeners/SetUserActive.php rename to app/Listeners/UserStateListener.php index 2a484bf9f..4937746f4 100644 --- a/app/Listeners/SetUserActive.php +++ b/app/Listeners/UserStateListener.php @@ -7,7 +7,7 @@ use App\Events\UserStateChanged; use App\Models\Enums\UserState; -class SetUserActive extends Listener +class UserStateListener extends Listener { public function handle(PirepFiled $event): void { diff --git a/app/Models/News.php b/app/Models/News.php index f34259d01..644b5a873 100644 --- a/app/Models/News.php +++ b/app/Models/News.php @@ -4,6 +4,10 @@ use App\Contracts\Model; +/** + * @property string subject + * @property string body + */ class News extends Model { public $table = 'news'; diff --git a/app/Notifications/Admin/UserRegistered.php b/app/Notifications/Admin/UserRegistered.php deleted file mode 100644 index 091db41c4..000000000 --- a/app/Notifications/Admin/UserRegistered.php +++ /dev/null @@ -1,61 +0,0 @@ -user = $user; - } - - /** - * Get the notification's delivery channels. - * - * @param mixed $notifiable - * - * @return array - */ - 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) - { - return (new MailMessage()) - ->from(config('mail.from.address')) - ->markdown('mail.admin.user.registered') - ->subject('A new user registered') - ->with(['user' => $this->user]); - } - - public function toArray($notifiable) - { - return [ - 'user_id' => $this->user->id, - ]; - } -} diff --git a/app/Notifications/BaseNotification.php b/app/Notifications/BaseNotification.php new file mode 100644 index 000000000..3b68b31c5 --- /dev/null +++ b/app/Notifications/BaseNotification.php @@ -0,0 +1,41 @@ +channels = $notif_config[$klass]; + } + + /** + * Get the notification's delivery channels. + * + * @param mixed $notifiable + * + * @return array + */ + public function via($notifiable) + { + return $this->channels; + } +} diff --git a/app/Notifications/Channels/MailChannel.php b/app/Notifications/Channels/MailChannel.php new file mode 100644 index 000000000..3cb150b01 --- /dev/null +++ b/app/Notifications/Channels/MailChannel.php @@ -0,0 +1,41 @@ +mailSubject = $subject; + $this->mailTemplate = $template; + $this->mailTemplateArgs = $args; + } + + /** + * Get the mail representation of the notification. + * + * @param mixed $notifiable + * + * @return \Illuminate\Notifications\Messages\MailMessage + */ + public function toMail($notifiable) + { + return (new MailMessage()) + ->from(config('mail.from.address', 'no-reply@phpvms.net')) + ->subject($this->mailSubject) + ->markdown($this->mailTemplate, $this->mailTemplateArgs); + } +} diff --git a/app/Listeners/NotificationEvents.php b/app/Notifications/EventHandler.php similarity index 60% rename from app/Listeners/NotificationEvents.php rename to app/Notifications/EventHandler.php index 192d87deb..f1fa94a04 100644 --- a/app/Listeners/NotificationEvents.php +++ b/app/Notifications/EventHandler.php @@ -1,8 +1,9 @@ 'onPirepAccepted', + PirepFiled::class => 'onPirepFile', + PirepRejected::class => 'onPirepRejected', + UserRegistered::class => 'onUserRegister', + UserStateChanged::class => 'onUserStateChange', + ]; + + public function __construct() { - $events->listen(UserRegistered::class, 'App\Listeners\NotificationEvents@onUserRegister'); - $events->listen(UserStateChanged::class, 'App\Listeners\NotificationEvents@onUserStateChange'); - $events->listen(PirepFiled::class, 'App\Listeners\NotificationEvents@onPirepFile'); - $events->listen(PirepAccepted::class, 'App\Listeners\NotificationEvents@onPirepAccepted'); - $events->listen(PirepRejected::class, 'App\Listeners\NotificationEvents@onPirepRejected'); + static::$broadcastNotifyable = app(Broadcast::class); } /** @@ -43,7 +50,7 @@ protected function notifyAdmins($notification) try { Notification::send($admin_users, $notification); - } catch (\Exception $e) { + } catch (Exception $e) { Log::emergency('Error emailing admins, malformed email='.$e->getMessage()); } } @@ -56,7 +63,23 @@ protected function notifyUser($user, $notification) { try { $user->notify($notification); - } catch (\Exception $e) { + } catch (Exception $e) { + Log::emergency('Error emailing admins, malformed email='.$e->getMessage()); + } + } + + /** + * Send a notification to all users + * + * @param $notification + */ + protected function notifyAllUsers($notification) + { + $users = User::all()->get(); + + try { + Notification::send($users, $notification); + } catch (Exception $e) { Log::emergency('Error emailing admins, malformed email='.$e->getMessage()); } } @@ -70,21 +93,20 @@ public function onUserRegister(UserRegistered $event): void { Log::info('NotificationEvents::onUserRegister: ' .$event->user->ident.' is ' - .UserState::label($event->user->state) - .', sending active email'); + .UserState::label($event->user->state).', sending active email'); /* * Send all of the admins a notification that a new user registered */ - $this->notifyAdmins(new \App\Notifications\Admin\UserRegistered($event->user)); + $this->notifyAdmins(new Messages\AdminUserRegistered($event->user)); /* * Send the user a confirmation email */ if ($event->user->state === UserState::ACTIVE) { - $this->notifyUser($event->user, new \App\Notifications\UserRegistered($event->user)); + $this->notifyUser($event->user, new Messages\UserRegistered($event->user)); } elseif ($event->user->state === UserState::PENDING) { - $this->notifyUser($event->user, new \App\Notifications\UserPending($event->user)); + $this->notifyUser($event->user, new UserPending($event->user)); } } @@ -99,9 +121,9 @@ public function onUserStateChange(UserStateChanged $event): void if ($event->old_state === UserState::PENDING) { if ($event->user->state === UserState::ACTIVE) { - $this->notifyUser($event->user, new \App\Notifications\UserRegistered($event->user)); + $this->notifyUser($event->user, new Messages\UserRegistered($event->user)); } elseif ($event->user->state === UserState::REJECTED) { - $this->notifyUser($event->user, new \App\Notifications\UserRejected($event->user)); + $this->notifyUser($event->user, new UserRejected($event->user)); } } elseif ($event->old_state === UserState::ACTIVE) { Log::info('User state change from active to ??'); @@ -127,7 +149,7 @@ public function onPirepFile(PirepFiled $event): void public function onPirepAccepted(PirepAccepted $event): void { Log::info('NotificationEvents::onPirepAccepted: '.$event->pirep->id.' accepted'); - $this->notifyUser($event->pirep->user, new \App\Notifications\PirepAccepted($event->pirep)); + $this->notifyUser($event->pirep->user, new Messages\PirepAccepted($event->pirep)); } /** @@ -138,6 +160,17 @@ public function onPirepAccepted(PirepAccepted $event): void public function onPirepRejected(PirepRejected $event): void { Log::info('NotificationEvents::onPirepRejected: '.$event->pirep->id.' rejected'); - $this->notifyUser($event->pirep->user, new \App\Notifications\PirepRejected($event->pirep)); + $this->notifyUser($event->pirep->user, new Messages\PirepRejected($event->pirep)); + } + + /** + * Notify all users of a news event + * + * @param \App\Events\NewsAdded $event + */ + public function onNewsAdded(NewsAdded $event): void + { + Log::info('NotificationEvents::onNewsAdded'); + $this->notifyAllUsers(new Messages\NewsAdded($event->news)); } } diff --git a/app/Notifications/Messages/AdminUserRegistered.php b/app/Notifications/Messages/AdminUserRegistered.php new file mode 100644 index 000000000..a007641b6 --- /dev/null +++ b/app/Notifications/Messages/AdminUserRegistered.php @@ -0,0 +1,38 @@ +user = $user; + $this->setMailable( + 'A new user registered', + 'notifications.mail.admin.user.registered', + ['user' => $user] + ); + } + + public function toArray($notifiable) + { + return [ + 'user_id' => $this->user->id, + ]; + } +} diff --git a/app/Notifications/Messages/NewsAdded.php b/app/Notifications/Messages/NewsAdded.php new file mode 100644 index 000000000..38ae343d6 --- /dev/null +++ b/app/Notifications/Messages/NewsAdded.php @@ -0,0 +1,40 @@ +news = $news; + $this->setMailable( + $news->subject, + 'notifications.mail.news', + ['news' => $news] + ); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * + * @return array + */ + public function toArray($notifiable) + { + return [ + 'news_id' => $this->news->id, + ]; + } +} diff --git a/app/Notifications/Messages/PirepAccepted.php b/app/Notifications/Messages/PirepAccepted.php new file mode 100644 index 000000000..709796219 --- /dev/null +++ b/app/Notifications/Messages/PirepAccepted.php @@ -0,0 +1,50 @@ +pirep = $pirep; + + $this->setMailable( + 'PIREP Accepted!', + 'notifications.mail.pirep.accepted', + ['pirep' => $this->pirep] + ); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * + * @return array + */ + public function toArray($notifiable) + { + return [ + 'pirep_id' => $this->pirep->id, + 'user_id' => $this->pirep->user_id, + ]; + } +} diff --git a/app/Notifications/Messages/PirepRejected.php b/app/Notifications/Messages/PirepRejected.php new file mode 100644 index 000000000..6c5ade9b6 --- /dev/null +++ b/app/Notifications/Messages/PirepRejected.php @@ -0,0 +1,47 @@ +pirep = $pirep; + + $this->setMailable( + 'PIREP Rejected!', + 'notifications.mail.pirep.rejected', + ['pirep' => $this->pirep] + ); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * + * @return array + */ + public function toArray($notifiable) + { + return [ + 'pirep_id' => $this->pirep->id, + 'user_id' => $this->pirep->user_id, + ]; + } +} diff --git a/app/Notifications/Messages/PirepSubmitted.php b/app/Notifications/Messages/PirepSubmitted.php new file mode 100644 index 000000000..bcceedffd --- /dev/null +++ b/app/Notifications/Messages/PirepSubmitted.php @@ -0,0 +1,47 @@ +pirep = $pirep; + + $this->setMailable( + 'New PIREP Submitted', + 'notifications.mail.admin.pirep.submitted', + ['pirep' => $this->pirep] + ); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * + * @return array + */ + public function toArray($notifiable) + { + return [ + 'pirep_id' => $this->pirep->id, + 'user_id' => $this->pirep->user_id, + ]; + } +} diff --git a/app/Notifications/Messages/UserPending.php b/app/Notifications/Messages/UserPending.php new file mode 100644 index 000000000..000eb3931 --- /dev/null +++ b/app/Notifications/Messages/UserPending.php @@ -0,0 +1,42 @@ +user = $user; + + $this->setMailable( + 'Your registration is pending', + 'notifications.mail.user.pending', + ['user' => $this->user] + ); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * + * @return array + */ + public function toArray($notifiable) + { + return [ + 'user_id' => $this->user->id, + ]; + } +} diff --git a/app/Notifications/Messages/UserRegistered.php b/app/Notifications/Messages/UserRegistered.php new file mode 100644 index 000000000..0c766a442 --- /dev/null +++ b/app/Notifications/Messages/UserRegistered.php @@ -0,0 +1,39 @@ +user = $user; + + $this->setMailable( + 'Welcome to '.config('app.name').'!', + 'notifications.mail.user.registered', + ['user' => $this->user] + ); + } + + public function toArray($notifiable) + { + return [ + 'user_id' => $this->user->id, + ]; + } +} diff --git a/app/Notifications/Messages/UserRejected.php b/app/Notifications/Messages/UserRejected.php new file mode 100644 index 000000000..8c4b8079a --- /dev/null +++ b/app/Notifications/Messages/UserRejected.php @@ -0,0 +1,44 @@ +user = $user; + + $this->setMailable( + 'Your registration has been denied', + 'notifications.mail.user.rejected', + ['user' => $this->user] + ); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * + * @return array + */ + public function toArray($notifiable) + { + return [ + 'user_id' => $this->user->id, + ]; + } +} diff --git a/app/Notifications/Backups.php b/app/Notifications/Notifiables/Backups.php similarity index 90% rename from app/Notifications/Backups.php rename to app/Notifications/Notifiables/Backups.php index f5f0668a6..788ec97a5 100644 --- a/app/Notifications/Backups.php +++ b/app/Notifications/Notifiables/Backups.php @@ -1,6 +1,6 @@ notify($eventclass); + */ +class Broadcast +{ + use Notifiable; + + /** + * Routing for Discord - the public channel ID that's used + */ + public function routeNotificationForDiscord() + { + return setting('notifications.discord_public_channel_id'); + } +} diff --git a/app/Notifications/PirepAccepted.php b/app/Notifications/PirepAccepted.php deleted file mode 100644 index 14479fb0d..000000000 --- a/app/Notifications/PirepAccepted.php +++ /dev/null @@ -1,68 +0,0 @@ -pirep = $pirep; - } - - /** - * Get the notification's delivery channels. - * - * @param mixed $notifiable - * - * @return array - */ - 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) - { - return (new MailMessage()) - ->from(config('mail.from.address', 'no-reply@phpvms.net')) - ->subject('PIREP Accepted!') - ->markdown('mail.pirep.accepted', ['pirep' => $this->pirep]); - } - - /** - * Get the array representation of the notification. - * - * @param mixed $notifiable - * - * @return array - */ - public function toArray($notifiable) - { - return [ - 'pirep_id' => $this->pirep->id, - 'user_id' => $this->pirep->user_id, - ]; - } -} diff --git a/app/Notifications/PirepRejected.php b/app/Notifications/PirepRejected.php deleted file mode 100644 index 6242f8676..000000000 --- a/app/Notifications/PirepRejected.php +++ /dev/null @@ -1,68 +0,0 @@ -pirep = $pirep; - } - - /** - * Get the notification's delivery channels. - * - * @param mixed $notifiable - * - * @return array - */ - 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) - { - return (new MailMessage()) - ->from(config('mail.from.address', 'no-reply@phpvms.net')) - ->subject('PIREP Rejected!') - ->markdown('mail.pirep.rejected', ['pirep' => $this->pirep]); - } - - /** - * Get the array representation of the notification. - * - * @param mixed $notifiable - * - * @return array - */ - public function toArray($notifiable) - { - return [ - 'pirep_id' => $this->pirep->id, - 'user_id' => $this->pirep->user_id, - ]; - } -} diff --git a/app/Notifications/PirepSubmitted.php b/app/Notifications/PirepSubmitted.php deleted file mode 100644 index 251000c84..000000000 --- a/app/Notifications/PirepSubmitted.php +++ /dev/null @@ -1,68 +0,0 @@ -pirep = $pirep; - } - - /** - * Get the notification's delivery channels. - * - * @param mixed $notifiable - * - * @return array - */ - 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) - { - return (new MailMessage()) - ->from(config('mail.from.address', 'no-reply@phpvms.net')) - ->subject('New PIREP Submitted') - ->markdown('mail.admin.pirep.submitted', ['pirep' => $this->pirep]); - } - - /** - * Get the array representation of the notification. - * - * @param mixed $notifiable - * - * @return array - */ - public function toArray($notifiable) - { - return [ - 'pirep_id' => $this->pirep->id, - 'user_id' => $this->pirep->user_id, - ]; - } -} diff --git a/app/Notifications/UserPending.php b/app/Notifications/UserPending.php deleted file mode 100644 index 0d9e762be..000000000 --- a/app/Notifications/UserPending.php +++ /dev/null @@ -1,65 +0,0 @@ -user = $user; - } - - /** - * Get the notification's delivery channels. - * - * @param mixed $notifiable - * - * @return array - */ - 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) - { - return (new MailMessage()) - ->from(config('mail.from.address', 'no-reply@phpvms.net')) - ->subject('Your registration is pending') - ->markdown('mail.user.pending', ['user' => $this->user]); - } - - /** - * Get the array representation of the notification. - * - * @param mixed $notifiable - * - * @return array - */ - public function toArray($notifiable) - { - return [ - 'user_id' => $this->user->id, - ]; - } -} diff --git a/app/Notifications/UserRegistered.php b/app/Notifications/UserRegistered.php deleted file mode 100644 index b32a9adf3..000000000 --- a/app/Notifications/UserRegistered.php +++ /dev/null @@ -1,60 +0,0 @@ -user = $user; - } - - /** - * Get the notification's delivery channels. - * - * @param mixed $notifiable - * - * @return array - */ - 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) - { - return (new MailMessage()) - ->from(config('mail.from.address', 'no-reply@phpvms.net')) - ->subject('Welcome to '.config('app.name').'!') - ->markdown('mail.user.registered', ['user' => $this->user]); - } - - public function toArray($notifiable) - { - return [ - 'user_id' => $this->user->id, - ]; - } -} diff --git a/app/Notifications/UserRejected.php b/app/Notifications/UserRejected.php deleted file mode 100644 index 187144aaa..000000000 --- a/app/Notifications/UserRejected.php +++ /dev/null @@ -1,65 +0,0 @@ -user = $user; - } - - /** - * Get the notification's delivery channels. - * - * @param mixed $notifiable - * - * @return array - */ - 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) - { - return (new MailMessage()) - ->from(config('mail.from.address', 'no-reply@phpvms.net')) - ->subject('Your registration has been denied') - ->markdown('mail.user.rejected', ['user' => $this->user]); - } - - /** - * Get the array representation of the notification. - * - * @param mixed $notifiable - * - * @return array - */ - public function toArray($notifiable) - { - return [ - 'user_id' => $this->user->id, - ]; - } -} diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index f2758991d..6accec41c 100755 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -6,11 +6,11 @@ use App\Events\PirepFiled; use App\Events\UserStatsChanged; use App\Listeners\AwardListener; -use App\Listeners\BidEvents; +use App\Listeners\BidEventHandler; use App\Listeners\ExpenseListener; -use App\Listeners\FinanceEvents; -use App\Listeners\NotificationEvents; -use App\Listeners\SetUserActive; +use App\Listeners\FinanceEventHandler; +use App\Listeners\UserStateListener; +use App\Notifications\EventHandler; use Illuminate\Auth\Events\Registered; use Illuminate\Auth\Listeners\SendEmailVerificationNotification; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; @@ -23,7 +23,7 @@ class EventServiceProvider extends ServiceProvider ], PirepFiled::class => [ - SetUserActive::class, + UserStateListener::class, ], Registered::class => [ @@ -36,8 +36,8 @@ class EventServiceProvider extends ServiceProvider ]; protected $subscribe = [ - BidEvents::class, - FinanceEvents::class, - NotificationEvents::class, + BidEventHandler::class, + FinanceEventHandler::class, + EventHandler::class, ]; } diff --git a/app/Services/AwardService.php b/app/Services/AwardService.php index 6fad93169..302fd9b4e 100644 --- a/app/Services/AwardService.php +++ b/app/Services/AwardService.php @@ -4,6 +4,7 @@ use App\Contracts\Service; use App\Support\ClassLoader; +use function get_class; use Nwidart\Modules\Facades\Module; class AwardService extends Service @@ -18,9 +19,9 @@ public function findAllAwardClasses(): array $awards = []; $formatted_awards = []; - // Find the awards in the app/Awards directory - $classes = ClassLoader::getClassesInPath(app_path('/Awards')); - $awards = array_merge($awards, $classes); + // Find the awards in the modules/Awards directory +// $classes = ClassLoader::getClassesInPath(module_path('Awards')); +// $awards = array_merge($awards, $classes); // Look throughout all the other modules, in the module/{MODULE}/Awards directory foreach (Module::all() as $module) { @@ -33,7 +34,7 @@ public function findAllAwardClasses(): array } foreach ($awards as $award) { - $formatted_awards[\get_class($award)] = $award; + $formatted_awards[get_class($award)] = $award; } return $formatted_awards; diff --git a/app/Services/NewsService.php b/app/Services/NewsService.php new file mode 100644 index 000000000..17dd79e36 --- /dev/null +++ b/app/Services/NewsService.php @@ -0,0 +1,44 @@ +newsRepo = $newsRepo; + } + + /** + * Add a news item + * + * @param array $attrs + * + * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return mixed + */ + public function addNews(array $attrs) + { + $news = $this->newsRepo->create($attrs); + event(new NewsAdded($news)); + + return $news; + } + + /** + * Delete something from the news items + * + * @param int $id ID of the news row to delete + */ + public function deleteNews($id) + { + $this->newsRepo->delete($id); + } +} diff --git a/config/backup.php b/config/backup.php index 4597f86d8..78922107f 100644 --- a/config/backup.php +++ b/config/backup.php @@ -1,6 +1,6 @@ [ + AdminUserRegistered::class => ['mail'], + NewsAdded::class => ['mail'], + PirepAccepted::class => ['mail'], + PirepRejected::class => ['mail'], + PirepSubmitted::class => ['mail'], + UserPending::class => ['mail'], + UserRegistered::class => ['mail'], + UserRejected::class => ['mail'], + ], +]; diff --git a/modules/.gitignore b/modules/.gitignore index ab3dacddf..4e7f20b3f 100644 --- a/modules/.gitignore +++ b/modules/.gitignore @@ -3,6 +3,7 @@ /* /*/ !.gitignore +!/Awards !/Installer !/Sample !/Vacentral diff --git a/app/Awards/PilotFlightAwards.php b/modules/Awards/Awards/PilotFlightAwards.php similarity index 88% rename from app/Awards/PilotFlightAwards.php rename to modules/Awards/Awards/PilotFlightAwards.php index 2af6adbb4..528b0e710 100644 --- a/app/Awards/PilotFlightAwards.php +++ b/modules/Awards/Awards/PilotFlightAwards.php @@ -1,12 +1,14 @@ subject }} + +$news->body + +@component('mail::button', ['url' => route('frontend.pireps.show', [$pirep->id])]) +View PIREP +@endcomponent + +Thanks,
+{{ config('app.name') }} +@endcomponent diff --git a/resources/views/mail/pirep/accepted.blade.php b/resources/views/notifications/mail/pirep/accepted.blade.php similarity index 100% rename from resources/views/mail/pirep/accepted.blade.php rename to resources/views/notifications/mail/pirep/accepted.blade.php diff --git a/resources/views/mail/pirep/rejected.blade.php b/resources/views/notifications/mail/pirep/rejected.blade.php similarity index 100% rename from resources/views/mail/pirep/rejected.blade.php rename to resources/views/notifications/mail/pirep/rejected.blade.php diff --git a/resources/views/mail/user/new_login_details.blade.php b/resources/views/notifications/mail/user/new_login_details.blade.php similarity index 100% rename from resources/views/mail/user/new_login_details.blade.php rename to resources/views/notifications/mail/user/new_login_details.blade.php diff --git a/resources/views/mail/user/pending.blade.php b/resources/views/notifications/mail/user/pending.blade.php similarity index 100% rename from resources/views/mail/user/pending.blade.php rename to resources/views/notifications/mail/user/pending.blade.php diff --git a/resources/views/mail/user/registered.blade.php b/resources/views/notifications/mail/user/registered.blade.php similarity index 100% rename from resources/views/mail/user/registered.blade.php rename to resources/views/notifications/mail/user/registered.blade.php diff --git a/resources/views/mail/user/rejected.blade.php b/resources/views/notifications/mail/user/rejected.blade.php similarity index 100% rename from resources/views/mail/user/rejected.blade.php rename to resources/views/notifications/mail/user/rejected.blade.php diff --git a/tests/AwardsTest.php b/tests/AwardsTest.php index 99a6dd408..8fba76eee 100644 --- a/tests/AwardsTest.php +++ b/tests/AwardsTest.php @@ -34,7 +34,7 @@ public function testAwardsGiven() { // Create one award that's given out with one flight $award = factory(App\Models\Award::class)->create([ - 'ref_model' => App\Awards\PilotFlightAwards::class, + 'ref_model' => Modules\Awards\Awards\PilotFlightAwards::class, 'ref_model_params' => 1, ]); diff --git a/tests/PIREPTest.php b/tests/PIREPTest.php index 622a64fab..48e6dc22c 100644 --- a/tests/PIREPTest.php +++ b/tests/PIREPTest.php @@ -6,11 +6,13 @@ use App\Models\Enums\PirepState; use App\Models\Pirep; use App\Models\User; +use App\Notifications\Messages\PirepAccepted; use App\Repositories\SettingRepository; use App\Services\BidService; use App\Services\FlightService; use App\Services\PirepService; use Carbon\Carbon; +use Illuminate\Support\Facades\Notification; class PIREPTest extends TestCase { @@ -81,7 +83,6 @@ public function testAddPirep() * Now set the PIREP state to ACCEPTED */ $new_pirep_count = $pirep->pilot->flights + 1; - $original_flight_time = $pirep->pilot->flight_time; $new_flight_time = $pirep->pilot->flight_time + $pirep->flight_time; $this->pirepSvc->changeState($pirep, PirepState::ACCEPTED); @@ -96,6 +97,9 @@ public function testAddPirep() $this->get('/api/fleet/aircraft/'.$pirep->aircraft_id, [], $user) ->assertJson(['data' => ['airport_id' => $pirep->arr_airport_id]]); + // Make sure a notification was sent out to both the user and the admin(s) + Notification::assertSentTo([$user], PirepAccepted::class); + // Try cancelling it $uri = '/api/pireps/'.$pirep->id.'/cancel'; $response = $this->put($uri, [], [], $user); diff --git a/tests/TestCase.php b/tests/TestCase.php index 0a74418ed..5fbaf5267 100755 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -8,7 +8,7 @@ use GuzzleHttp\Psr7\Response; use Illuminate\Routing\Middleware\ThrottleRequests; use Illuminate\Support\Facades\Artisan; -use Illuminate\Support\Facades\Mail; +use Illuminate\Support\Facades\Notification; use Tests\CreatesApplication; use Tests\TestData; @@ -46,7 +46,7 @@ public function setUp() : void ThrottleRequests::class ); - Mail::fake(); + Notification::fake(); Artisan::call('database:create', ['--reset' => true]); Artisan::call('migrate:refresh', ['--env' => 'testing']); From f95a3f336bcbaa1f9b38f145460cc1f87e9940d0 Mon Sep 17 00:00:00 2001 From: Nabeel S Date: Sat, 23 Nov 2019 12:58:48 -0500 Subject: [PATCH 002/172] Fix missing newsRepo (#445) --- app/Http/Controllers/Admin/DashboardController.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php index 81b007cef..990573c40 100644 --- a/app/Http/Controllers/Admin/DashboardController.php +++ b/app/Http/Controllers/Admin/DashboardController.php @@ -4,6 +4,7 @@ use App\Contracts\Controller; use App\Repositories\KvpRepository; +use App\Repositories\NewsRepository; use App\Repositories\PirepRepository; use App\Repositories\UserRepository; use App\Services\NewsService; @@ -15,6 +16,7 @@ class DashboardController extends Controller { private $kvpRepo; + private $newsRepo; private $newsSvc; private $pirepRepo; private $userRepo; @@ -23,20 +25,23 @@ class DashboardController extends Controller * DashboardController constructor. * * @param KvpRepository $kvpRepo + * @param NewsRepository $newsRepo + * @param NewsService $newsSvc * @param PirepRepository $pirepRepo * @param UserRepository $userRepo - * @param $newsSvc */ public function __construct( KvpRepository $kvpRepo, + NewsRepository $newsRepo, NewsService $newsSvc, PirepRepository $pirepRepo, UserRepository $userRepo ) { $this->kvpRepo = $kvpRepo; + $this->newsRepo = $newsRepo; + $this->newsSvc = $newsSvc; $this->pirepRepo = $pirepRepo; $this->userRepo = $userRepo; - $this->newsSvc = $newsSvc; } /** From 50dc79bc8d0ca2be3e363a28580ffe82aacc3f57 Mon Sep 17 00:00:00 2001 From: Nabeel S Date: Wed, 27 Nov 2019 09:19:20 -0500 Subject: [PATCH 003/172] Refactor and add importer to Installer module #443 (#444) * Refactor and add importer to Installer module #443 * Refactor for finances to use in import * Import groups into roles * Formatting * Formatting * Add interface in installer for import * Notes about importing * Check for installer folder * Formatting * Fix pirep->user mapping * Unused import * Formatting --- Makefile | 2 +- app/Console/Commands/CreateConfigs.php | 95 ++ app/Console/Commands/CreateDatabase.php | 6 +- app/Console/Commands/ImportFromClassic.php | 28 - app/Console/Services/Importer.php | 704 --------------- app/Contracts/Middleware.php | 11 + app/Contracts/Model.php | 7 +- .../2019_07_16_141152_users_add_pilot_id.php | 22 - app/Database/seeds/permissions.yml | 2 +- .../Controllers/Admin/DashboardController.php | 3 +- .../Controllers/Admin/RolesController.php | 30 +- app/Http/Middleware/ApiAuth.php | 8 +- app/Http/Middleware/EncryptCookies.php | 3 +- app/Http/Middleware/InstalledCheck.php | 15 +- app/Http/Middleware/JsonResponse.php | 6 +- app/Http/Middleware/MeasureExecutionTime.php | 14 +- .../Middleware/RedirectIfAuthenticated.php | 15 +- app/Http/Middleware/SetActiveTheme.php | 6 +- app/Http/Middleware/UpdatePending.php | 12 +- app/Http/Middleware/VerifyCsrfToken.php | 3 +- app/Models/Permission.php | 3 + app/Models/Role.php | 2 + app/Models/User.php | 4 + app/Providers/AppServiceProvider.php | 2 +- app/Services/Finance/PirepFinanceService.php | 37 +- .../Finance/RecurringFinanceService.php | 25 +- app/Services/FinanceService.php | 82 ++ app/Services/Installer/SeederService.php | 23 +- app/Services/RoleService.php | 47 + app/Services/UserService.php | 52 +- app/Support/Utils.php | 27 + composer.json | 2 +- composer.lock | 835 ++++++++++-------- config/modules.php | 12 + config/modules_statuses.json | 7 + config/queue.php | 2 +- config/repository.php | 2 +- intellij_style.xml | 21 +- modules/.gitignore | 1 + .../Awards/Providers/AwardServiceProvider.php | 9 + modules/Awards/module.json | 4 +- modules/Installer/Config/config.php | 19 + .../Commands/ImportFromClassicCommand.php | 53 ++ .../Exceptions/ImporterNextRecordSet.php | 22 + .../Exceptions/ImporterNoMoreRecords.php | 11 + .../Installer/Exceptions/StageCompleted.php | 17 + .../Http/Controllers/ImporterController.php | 87 ++ .../Http/Controllers/InstallerController.php | 3 - .../Http/Controllers/UpdaterController.php | 2 +- modules/Installer/Http/Routes/importer.php | 9 + .../Providers/InstallerServiceProvider.php | 20 +- .../views/importer/complete.blade.php | 20 + .../views/importer/step1-configure.blade.php | 134 +++ .../views/install/steps/step3-user.blade.php | 6 + .../Services/Importer/BaseImporter.php | 78 ++ .../Installer/Services/Importer/BaseStage.php | 68 ++ .../Services/Importer/ImporterService.php | 111 +++ .../Importer/Importers/AircraftImporter.php | 71 ++ .../Importer/Importers/AirlineImporter.php | 43 + .../Importer/Importers/AirportImporter.php | 43 + .../Importer/Importers/FlightImporter.php | 51 ++ .../Importer/Importers/GroupImporter.php | 100 +++ .../Importer/Importers/PirepImporter.php | 122 +++ .../Importer/Importers/RankImport.php | 31 + .../Importer/Importers/UserImport.php | 139 +++ .../Services/Importer/Stages/Stage1.php | 97 ++ .../Services/Importer/Stages/Stage2.php | 15 + .../Services/Importer/Stages/Stage3.php | 15 + .../Services/Importer/Stages/Stage4.php | 15 + .../Services/Importer/Stages/Stage5.php | 15 + .../Services/Importer/Stages/Stage6.php | 41 + modules/Installer/Utils/IdMapper.php | 49 + modules/Installer/Utils/ImporterDB.php | 159 ++++ modules/Installer/Utils/LoggerTrait.php | 23 + resources/views/admin/app.blade.php | 208 ++--- .../views/admin/dashboard/index.blade.php | 98 +- 76 files changed, 2754 insertions(+), 1432 deletions(-) create mode 100644 app/Console/Commands/CreateConfigs.php delete mode 100644 app/Console/Commands/ImportFromClassic.php delete mode 100644 app/Console/Services/Importer.php create mode 100644 app/Contracts/Middleware.php create mode 100644 app/Services/RoleService.php create mode 100644 app/Support/Utils.php create mode 100644 config/modules_statuses.json create mode 100644 modules/Awards/Providers/AwardServiceProvider.php create mode 100644 modules/Installer/Console/Commands/ImportFromClassicCommand.php create mode 100644 modules/Installer/Exceptions/ImporterNextRecordSet.php create mode 100644 modules/Installer/Exceptions/ImporterNoMoreRecords.php create mode 100644 modules/Installer/Exceptions/StageCompleted.php create mode 100644 modules/Installer/Http/Controllers/ImporterController.php create mode 100644 modules/Installer/Http/Routes/importer.php create mode 100644 modules/Installer/Resources/views/importer/complete.blade.php create mode 100644 modules/Installer/Resources/views/importer/step1-configure.blade.php create mode 100644 modules/Installer/Services/Importer/BaseImporter.php create mode 100644 modules/Installer/Services/Importer/BaseStage.php create mode 100644 modules/Installer/Services/Importer/ImporterService.php create mode 100644 modules/Installer/Services/Importer/Importers/AircraftImporter.php create mode 100644 modules/Installer/Services/Importer/Importers/AirlineImporter.php create mode 100644 modules/Installer/Services/Importer/Importers/AirportImporter.php create mode 100644 modules/Installer/Services/Importer/Importers/FlightImporter.php create mode 100644 modules/Installer/Services/Importer/Importers/GroupImporter.php create mode 100644 modules/Installer/Services/Importer/Importers/PirepImporter.php create mode 100644 modules/Installer/Services/Importer/Importers/RankImport.php create mode 100644 modules/Installer/Services/Importer/Importers/UserImport.php create mode 100644 modules/Installer/Services/Importer/Stages/Stage1.php create mode 100644 modules/Installer/Services/Importer/Stages/Stage2.php create mode 100644 modules/Installer/Services/Importer/Stages/Stage3.php create mode 100644 modules/Installer/Services/Importer/Stages/Stage4.php create mode 100644 modules/Installer/Services/Importer/Stages/Stage5.php create mode 100644 modules/Installer/Services/Importer/Stages/Stage6.php create mode 100644 modules/Installer/Utils/IdMapper.php create mode 100644 modules/Installer/Utils/ImporterDB.php create mode 100644 modules/Installer/Utils/LoggerTrait.php diff --git a/Makefile b/Makefile index 83e237775..dce22ee57 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ clean: @php artisan view:clear @find bootstrap/cache -type f -not -name '.gitignore' -print0 | xargs -0 rm -rf - @find storage/framework/cache/ -mindepth 1 -not -name '.gitignore' -print0 | xargs -0 rm -rf + @find storage/framework/cache/ -mindepth 1 -type f -not -name '.gitignore' -print0 | xargs -0 rm -rf @find storage/framework/sessions/ -mindepth 1 -type f -not -name '.gitignore' -print0 | xargs -0 rm -rf @find storage/framework/views/ -mindepth 1 -not -name '.gitignore' -print0 | xargs -0 rm -rf diff --git a/app/Console/Commands/CreateConfigs.php b/app/Console/Commands/CreateConfigs.php new file mode 100644 index 000000000..3d3a1813e --- /dev/null +++ b/app/Console/Commands/CreateConfigs.php @@ -0,0 +1,95 @@ +databaseSeeder = $databaseSeeder; + $this->seederSvc = $seederSvc; + } + + /** + * Run dev related commands + * + * @throws \Symfony\Component\HttpFoundation\File\Exception\FileException + */ + public function handle() + { + $this->writeConfigs(); + + // Reload the configuration + App::boot(); + + $this->info('Recreating database'); + $this->call('database:create', [ + '--reset' => true, + ]); + + $this->info('Running migrations'); + $this->call('migrate:fresh', [ + '--seed' => true, + ]); + + $this->seederSvc->syncAllSeeds(); + + $this->info('Done!'); + } + + /** + * Rewrite the configuration files + * + * @throws \Symfony\Component\HttpFoundation\File\Exception\FileException + */ + protected function writeConfigs() + { + /** @var ConfigService $cfgSvc */ + $cfgSvc = app(ConfigService::class); + + $this->info('Removing the old config files'); + + // Remove the old files + $config_file = base_path('config.php'); + if (file_exists($config_file)) { + unlink($config_file); + } + + $env_file = base_path('env.php'); + if (file_exists($env_file)) { + unlink($env_file); + } + + //{name} {db_host} {db_name} {db_user} {db_pass} + + $this->info('Regenerating the config files'); + $cfgSvc->createConfigFiles([ + 'APP_ENV' => 'dev', + 'SITE_NAME' => $this->argument('name'), + 'DB_CONN' => 'mysql', + 'DB_HOST' => $this->argument('db_host'), + 'DB_NAME' => $this->argument('db_name'), + 'DB_USER' => $this->argument('db_user'), + 'DB_PASS' => $this->argument('db_pass'), + ]); + + $this->info('Config files generated!'); + } +} diff --git a/app/Console/Commands/CreateDatabase.php b/app/Console/Commands/CreateDatabase.php index 03402c82a..aa99a9cc5 100644 --- a/app/Console/Commands/CreateDatabase.php +++ b/app/Console/Commands/CreateDatabase.php @@ -2,13 +2,14 @@ namespace App\Console\Commands; +use App\Console\Services\Database; use App\Contracts\Command; use Illuminate\Support\Facades\Log; use Tivie\OS\Detector; class CreateDatabase extends Command { - protected $signature = 'database:create {--reset} {--conn=?}'; + protected $signature = 'database:create {--reset} {--migrate} {--conn=?}'; protected $description = 'Create a database'; protected $os; @@ -36,8 +37,7 @@ protected function create_mysql($dbkey) $user = config($dbkey.'username'); $pass = config($dbkey.'password'); - $dbSvc = new \App\Console\Services\Database(); - + $dbSvc = new Database(); $dsn = $dbSvc->createDsn($host, $port); Log::info('Connection string: '.$dsn); diff --git a/app/Console/Commands/ImportFromClassic.php b/app/Console/Commands/ImportFromClassic.php deleted file mode 100644 index fbad3f503..000000000 --- a/app/Console/Commands/ImportFromClassic.php +++ /dev/null @@ -1,28 +0,0 @@ - $this->argument('db_host'), - 'name' => $this->argument('db_name'), - 'user' => $this->argument('db_user'), - 'pass' => $this->argument('db_pass'), - 'table_prefix' => $this->argument('table_prefix'), - ]; - - $importerSvc = new \App\Console\Services\Importer($db_creds); - $importerSvc->run(); - } -} diff --git a/app/Console/Services/Importer.php b/app/Console/Services/Importer.php deleted file mode 100644 index 1d727bc24..000000000 --- a/app/Console/Services/Importer.php +++ /dev/null @@ -1,704 +0,0 @@ -log = new ConsoleOutput(); - - // The db credentials - $this->creds = array_merge([ - 'host' => '127.0.0.1', - 'port' => 3306, - 'name' => '', - 'user' => '', - 'pass' => '', - 'table_prefix' => '', - ], $db_creds); - } - - /** - * @return int|void - */ - public function run() - { - $this->reconnect(); - - // Import all the different parts - $this->importRanks(); - $this->importAirlines(); - $this->importAircraft(); - $this->importAirports(); - - $this->importUsers(); - $this->importFlights(); - $this->importPireps(); - - // Finish up - $this->findLastPireps(); - $this->recalculateRanks(); - } - - /** - * Reconnect to the old phpVMS DB using PDO - */ - protected function reconnect() - { - $dsn = 'mysql:'.implode(';', [ - 'host='.$this->creds['host'], - 'port='.$this->creds['port'], - 'dbname='.$this->creds['name'], - ]); - - $this->info('Connection string: '.$dsn); - - try { - $this->conn = new PDO($dsn, $this->creds['user'], $this->creds['pass']); - $this->conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ); - } catch (\PDOException $e) { - $this->error($e); - exit(); - } - } - - /** - * @param $message - */ - protected function comment($message) - { - $this->log->writeln(''.$message.''); - } - - /** - * @param $message - */ - protected function error($message) - { - $this->log->writeln(''.$message.''); - } - - /** - * @param string|array $message - */ - protected function info($message) - { - if (\is_array($message)) { - /* @noinspection ForgottenDebugOutputInspection */ - print_r($message); - } else { - $this->log->writeln(''.$message.''); - } - } - - /** - * Return the table name with the prefix - * - * @param $table - * - * @return string - */ - protected function tableName($table) - { - if ($this->creds['table_prefix'] !== false) { - return $this->creds['table_prefix'].$table; - } - - return $table; - } - - /** - * @param \Illuminate\Database\Eloquent\Model $model - * - * @return bool - */ - protected function saveModel($model) - { - try { - $model->save(); - - return true; - } catch (QueryException $e) { - if ($e->getCode() !== '23000') { - $this->error($e); - } - - return false; - } - } - - /** - * Create a new mapping between an old ID and the new one - * - * @param $entity - * @param $old_id - * @param $new_id - */ - protected function addMapping($entity, $old_id, $new_id) - { - if (!array_key_exists($entity, $this->mappedEntities)) { - $this->mappedEntities[$entity] = []; - } - - $this->mappedEntities[$entity][$old_id] = $new_id; - } - - /** - * Return the ID for a mapping - * - * @param $entity - * @param $old_id - * - * @return bool - */ - protected function getMapping($entity, $old_id) - { - if (!array_key_exists($entity, $this->mappedEntities)) { - return 0; - } - - $entity = $this->mappedEntities[$entity]; - if (array_key_exists($old_id, $entity)) { - return $entity[$old_id]; - } - - return 0; - } - - /** - * @param $date - * - * @return Carbon - */ - protected function parseDate($date) - { - $carbon = Carbon::parse($date); - - return $carbon; - } - - /** - * Take a decimal duration and convert it to minutes - * - * @param $duration - * - * @return float|int - */ - protected function convertDuration($duration) - { - if (strpos($duration, '.') !== false) { - $delim = '.'; - } elseif (strpos($duration, ':')) { - $delim = ':'; - } else { - // no delimiter, assume it's just a straight hour - return (int) $duration * 60; - } - - $hm = explode($delim, $duration); - $hours = (int) $hm[0] * 60; - $mins = (int) $hm[1]; - - return $hours + $mins; - } - - /** - * @param $table - * - * @return mixed - */ - protected function getTotalRows($table) - { - $table = $this->tableName($table); - - $sql = 'SELECT COUNT(*) FROM '.$table; - $rows = $this->conn->query($sql)->fetchColumn(); - - $this->info('Found '.$rows.' rows in '.$table); - - return (int) $rows; - } - - /** - * Read all the rows in a table, but read them in a batched manner - * - * @param string $table The name of the table - * @param null $read_rows Number of rows to read - * - * @return \Generator - */ - protected function readRows($table, $read_rows = null) - { - // Set the table prefix if it has been entered - $this->tableName($table); - - $offset = 0; - if ($read_rows === null) { - $read_rows = self::BATCH_READ_ROWS; - } - - $total_rows = $this->getTotalRows($table); - - while ($offset < $total_rows) { - $rows_to_read = $offset + $read_rows; - if ($rows_to_read > $total_rows) { - $rows_to_read = $total_rows; - } - - $this->info('Reading '.$offset.' to '.$rows_to_read.' of '.$total_rows); - - $sql = 'SELECT * FROM '.$this->tableName($table) - .' LIMIT '.self::BATCH_READ_ROWS.' OFFSET '.$offset; - - try { - foreach ($this->conn->query($sql) as $row) { - yield $row; - } - } catch (PDOException $e) { - // Without incrementing the offset, it should re-run the same query - $this->error($e); - - if (strpos($e->getMessage(), 'server has gone away') !== false) { - $this->reconnect(); - continue; - } - } - - $offset += self::BATCH_READ_ROWS; - } - } - - /** - * Return the subfleet - * - * @return mixed - */ - protected function getSubfleet() - { - $airline = Airline::first(); - $subfleet = Subfleet::firstOrCreate( - ['airline_id' => $airline->id, 'name' => self::SUBFLEET_NAME], - ['type' => 'PHPVMS'] - ); - - return $subfleet; - } - - /** - * All the individual importers, done on a per-table basis - * Some tables get saved locally for tables that use FK refs - */ - - /** - * Import all of the ranks - */ - protected function importRanks() - { - $this->comment('--- RANK IMPORT ---'); - - $count = 0; - foreach ($this->readRows('ranks') as $row) { - $rank = Rank::firstOrCreate( - ['name' => $row->rank], - ['image_url' => $row->rankimage, 'hours' => $row->minhours] - ); - - $this->addMapping('ranks', $row->rankid, $rank->id); - $this->addMapping('ranks', $row->rank, $rank->id); - - if ($rank->wasRecentlyCreated) { - $count++; - } - } - - $this->info('Imported '.$count.' ranks'); - } - - /** - * Import all of the airlines. Save them all in the private var $airlines - * They're used to lookup from other reference tables - */ - protected function importAirlines() - { - $this->comment('--- AIRLINE IMPORT ---'); - - $count = 0; - foreach ($this->readRows('airlines') as $row) { - $airline = Airline::firstOrCreate( - ['icao' => $row->code], - ['iata' => $row->code, 'name' => $row->name, 'active' => $row->enabled] - ); - - $this->addMapping('airlines', $row->id, $airline->id); - $this->addMapping('airlines', $row->code, $airline->id); - - if ($airline->wasRecentlyCreated) { - $count++; - } - } - - $this->info('Imported '.$count.' airlines'); - } - - /** - * Imported the aircraft - */ - protected function importAircraft() - { - $this->comment('--- AIRCRAFT IMPORT ---'); - - $subfleet = $this->getSubfleet(); - - $this->info('Subfleet ID is '.$subfleet->id); - - $count = 0; - foreach ($this->readRows('aircraft') as $row) { - $aircraft = Aircraft::firstOrCreate( - ['name' => $row->fullname, 'registration' => $row->registration], - ['icao' => $row->icao, - 'subfleet_id' => $subfleet->id, - 'active' => $row->enabled, - ] - ); - - $this->addMapping('aircraft', $row->id, $aircraft->id); - - if ($aircraft->wasRecentlyCreated) { - $count++; - } - } - - $this->info('Imported '.$count.' aircraft'); - } - - /** - * Import all of the airports - */ - protected function importAirports() - { - $this->comment('--- AIRPORT IMPORT ---'); - - $count = 0; - foreach ($this->readRows('airports') as $row) { - $attrs = [ - 'id' => trim($row->icao), - 'icao' => trim($row->icao), - 'name' => $row->name, - 'country' => $row->country, - 'lat' => $row->lat, - 'lon' => $row->lng, - 'hub' => $row->hub, - ]; - - $airport = Airport::updateOrCreate( - ['id' => $attrs['id']], - $attrs - ); - - if ($airport->wasRecentlyCreated) { - $count++; - } - } - - $this->info('Imported '.$count.' airports'); - } - - /** - * Import the flights and schedules - */ - protected function importFlights() - { - $this->comment('--- FLIGHT SCHEDULE IMPORT ---'); - - $count = 0; - foreach ($this->readRows('schedules') as $row) { - $airline_id = $this->getMapping('airlines', $row->code); - - $flight_num = trim($row->flightnum); - - $attrs = [ - 'dpt_airport_id' => $row->depicao, - 'arr_airport_id' => $row->arricao, - 'route' => $row->route ?: '', - 'distance' => round($row->distance ?: 0, 2), - 'level' => $row->flightlevel ?: 0, - 'dpt_time' => $row->deptime ?: '', - 'arr_time' => $row->arrtime ?: '', - 'flight_time' => $this->convertDuration($row->flighttime) ?: '', - 'notes' => $row->notes ?: '', - 'active' => $row->enabled ?: true, - ]; - - try { - $flight = Flight::updateOrCreate( - ['airline_id' => $airline_id, 'flight_number' => $flight_num], - $attrs - ); - } catch (\Exception $e) { - //$this->error($e); - } - - $this->addMapping('flights', $row->id, $flight->id); - - // TODO: deserialize route_details into ACARS table - - if ($flight->wasRecentlyCreated) { - $count++; - } - } - - $this->info('Imported '.$count.' flights'); - } - - /** - * Import all of the PIREPs - */ - protected function importPireps() - { - $this->comment('--- PIREP IMPORT ---'); - - $count = 0; - foreach ($this->readRows('pireps') as $row) { - $pirep_id = $row->pirepid; - $user_id = $this->getMapping('users', $row->pilotid); - $airline_id = $this->getMapping('airlines', $row->code); - $aircraft_id = $this->getMapping('aircraft', $row->aircraft); - - $attrs = [ - //'id' => $pirep_id, - 'user_id' => $user_id, - 'airline_id' => $airline_id, - 'aircraft_id' => $aircraft_id, - 'flight_number' => $row->flightnum ?: '', - 'dpt_airport_id' => $row->depicao, - 'arr_airport_id' => $row->arricao, - 'block_fuel' => $row->fuelused, - 'route' => $row->route ?: '', - 'source_name' => $row->source, - 'created_at' => $this->parseDate($row->submitdate), - 'updated_at' => $this->parseDate($row->modifieddate), - ]; - - // Set the distance - $distance = round($row->distance ?: 0, 2); - $attrs['distance'] = $distance; - $attrs['planned_distance'] = $distance; - - // Set the flight time properly - $duration = $this->convertDuration($row->flighttime_stamp); - $attrs['flight_time'] = $duration; - $attrs['planned_flight_time'] = $duration; - - // Set how it was filed - if (strtoupper($row->source) === 'MANUAL') { - $attrs['source'] = PirepSource::MANUAL; - } else { - $attrs['source'] = PirepSource::ACARS; - } - - // Set the flight type - $row->flighttype = strtoupper($row->flighttype); - if ($row->flighttype === 'P') { - $attrs['flight_type'] = FlightType::SCHED_PAX; - } elseif ($row->flighttype === 'C') { - $attrs['flight_type'] = FlightType::SCHED_CARGO; - } else { - $attrs['flight_type'] = FlightType::CHARTER_PAX_ONLY; - } - - // Set the flight level of the PIREP is set - if (property_exists($row, 'flightlevel')) { - $attrs['level'] = $row->flightlevel; - } else { - $attrs['level'] = 0; - } - - $pirep = Pirep::updateOrCreate( - ['id' => $pirep_id], - $attrs - ); - - $source = strtoupper($row->source); - if ($source === 'SMARTCARS') { - // TODO: Parse smartcars log into the acars table - } elseif ($source === 'KACARS') { - // TODO: Parse kACARS log into acars table - } elseif ($source === 'XACARS') { - // TODO: Parse XACARS log into acars table - } - - // TODO: Add extra fields in as PIREP fields - $this->addMapping('pireps', $row->pirepid, $pirep->id); - - if ($pirep->wasRecentlyCreated) { - $count++; - } - } - - $this->info('Imported '.$count.' pireps'); - } - - protected function importUsers() - { - $this->comment('--- USER IMPORT ---'); - - $count = 0; - foreach ($this->readRows('pilots', 50) as $row) { - // TODO: What to do about pilot ids - - $name = $row->firstname.' '.$row->lastname; - - $airline_id = $this->getMapping('airlines', $row->code); - $rank_id = $this->getMapping('ranks', $row->rank); - $state = $this->getUserState($row->retired); - - $new_password = Str::random(60); - - $attrs = [ - 'name' => $name, - 'password' => Hash::make($new_password), - 'api_key' => Utils::generateApiKey(), - 'airline_id' => $airline_id, - 'rank_id' => $rank_id, - 'home_airport_id' => $row->hub, - 'curr_airport_id' => $row->hub, - 'flights' => (int) $row->totalflights, - 'flight_time' => Utils::hoursToMinutes($row->totalhours), - 'state' => $state, - 'created_at' => $this->parseDate($row->joindate), - ]; - - $user = User::updateOrCreate( - ['email' => $row->email], - $attrs - ); - - $this->addMapping('users', $row->pilotid, $user->id); - - if ($user->wasRecentlyCreated) { - $count++; - } - } - - $this->info('Imported '.$count.' users'); - } - - /** - * Go through and set the last PIREP ID for the users - */ - protected function findLastPireps() - { - } - - /** - * Recalculate all of the user ranks - */ - protected function recalculateRanks() - { - /*$this->comment('--- RECALCULATING RANKS ---');*/ - } - - /** - * Get the user's new state from their original state - * - * @param $state - * - * @return int - */ - protected function getUserState($state) - { - // TODO: This state might differ between simpilot and classic version - - $state = (int) $state; - - // Declare array of classic states - $phpvms_classic_states = [ - 'ACTIVE' => 0, - 'INACTIVE' => 1, - 'BANNED' => 2, - 'ON_LEAVE' => 3, - ]; - - // Decide which state they will be in accordance with v7 - if ($state === $phpvms_classic_states['ACTIVE']) { - return UserState::ACTIVE; - } - - if ($state === $phpvms_classic_states['INACTIVE']) { - // TODO: Make an inactive state? - return UserState::REJECTED; - } - - if ($state === $phpvms_classic_states['BANNED']) { - return UserState::SUSPENDED; - } - - if ($state === $phpvms_classic_states['ON_LEAVE']) { - return UserState::ON_LEAVE; - } - - $this->error('Unknown status: '.$state); - return UserState::ACTIVE; - } -} diff --git a/app/Contracts/Middleware.php b/app/Contracts/Middleware.php new file mode 100644 index 000000000..3fc761301 --- /dev/null +++ b/app/Contracts/Middleware.php @@ -0,0 +1,11 @@ +dropPrimary('users_id_primary'); - $table->dropColumn('id'); - $table->string('id', Model::ID_MAX_LENGTH)->primary(); - }); - - // Update the users to use the `pilot_id` (so we don't need to migrate data from other tables) - $users = DB::table('users')->get(['id']); - foreach ($users as $user) { - $user->id = $user->pilot_id; - $user->save(); - }*/ - - // role_user - // permission_user - // sessions - // pireps - // bids - // news - // user_awards } /** diff --git a/app/Database/seeds/permissions.yml b/app/Database/seeds/permissions.yml index a1fd89f6e..222cc5189 100644 --- a/app/Database/seeds/permissions.yml +++ b/app/Database/seeds/permissions.yml @@ -1,7 +1,7 @@ # All of the different permissions that can be assigned to roles --- - name: admin-access - display_name: Admin Access + display_name: Administrator description: Access the admin panel - name: airlines display_name: Airlines diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php index 990573c40..79495ea40 100644 --- a/app/Http/Controllers/Admin/DashboardController.php +++ b/app/Http/Controllers/Admin/DashboardController.php @@ -79,7 +79,8 @@ public function index(Request $request) $this->checkNewVersion(); return view('admin.dashboard.index', [ - 'news' => $this->newsRepo->getLatest(), + 'news' => $this->newsRepo->getLatest(), +// 'installer_enabled' => $installerEnabled, 'pending_pireps' => $this->pirepRepo->getPendingCount(), 'pending_users' => $this->userRepo->getPendingCount(), ]); diff --git a/app/Http/Controllers/Admin/RolesController.php b/app/Http/Controllers/Admin/RolesController.php index 00362ba09..b1c0f144f 100644 --- a/app/Http/Controllers/Admin/RolesController.php +++ b/app/Http/Controllers/Admin/RolesController.php @@ -7,29 +7,33 @@ use App\Http\Requests\UpdateRoleRequest; use App\Repositories\PermissionsRepository; use App\Repositories\RoleRepository; -use Flash; +use App\Services\RoleService; use Illuminate\Http\Request; +use Illuminate\Http\Response; +use Laracasts\Flash\Flash; use Prettus\Repository\Criteria\RequestCriteria; -use Response; -/** - * Class AirlinesController - */ class RolesController extends Controller { private $permsRepo; private $rolesRepo; + private $roleSvc; /** * AirlinesController constructor. * * @param PermissionsRepository $permsRepo * @param RoleRepository $rolesRepo + * @param $roleSvc */ - public function __construct(PermissionsRepository $permsRepo, RoleRepository $rolesRepo) - { + public function __construct( + PermissionsRepository $permsRepo, + RoleRepository $rolesRepo, + RoleService $roleSvc + ) { $this->permsRepo = $permsRepo; $this->rolesRepo = $rolesRepo; + $this->roleSvc = $roleSvc; } /** @@ -132,8 +136,6 @@ public function edit($id) * @param int $id * @param UpdateRoleRequest $request * - * @throws \Prettus\Validator\Exceptions\ValidatorException - * * @return Response */ public function update($id, UpdateRoleRequest $request) @@ -145,14 +147,8 @@ public function update($id, UpdateRoleRequest $request) return redirect(route('admin.roles.index')); } - $this->rolesRepo->update($request->all(), $id); - - // Update the permissions, filter out null/invalid values - $perms = collect($request->permissions)->filter(static function ($v, $k) { - return $v; - }); - - $role->permissions()->sync($perms); + $this->roleSvc->updateRole($role, $request->all()); + $this->roleSvc->setPermissionsForRole($role, $request->permissions); Flash::success('Roles updated successfully.'); return redirect(route('admin.roles.index')); diff --git a/app/Http/Middleware/ApiAuth.php b/app/Http/Middleware/ApiAuth.php index 5064e8b83..acbd24bc3 100644 --- a/app/Http/Middleware/ApiAuth.php +++ b/app/Http/Middleware/ApiAuth.php @@ -5,12 +5,14 @@ namespace App\Http\Middleware; +use App\Contracts\Middleware; use App\Models\Enums\UserState; use App\Models\User; -use Auth; use Closure; +use Illuminate\Http\Request; +use Illuminate\Support\Facades\Auth; -class ApiAuth +class ApiAuth implements Middleware { /** * Handle an incoming request. @@ -20,7 +22,7 @@ class ApiAuth * * @return mixed */ - public function handle($request, Closure $next) + public function handle(Request $request, Closure $next) { // Check if Authorization header is in place $api_key = $request->header('x-api-key', null); diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php index 15a20c00d..c1f35f47a 100755 --- a/app/Http/Middleware/EncryptCookies.php +++ b/app/Http/Middleware/EncryptCookies.php @@ -2,9 +2,10 @@ namespace App\Http\Middleware; +use App\Contracts\Middleware; use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter; -class EncryptCookies extends BaseEncrypter +class EncryptCookies extends BaseEncrypter implements Middleware { /** * The names of the cookies that should not be encrypted. diff --git a/app/Http/Middleware/InstalledCheck.php b/app/Http/Middleware/InstalledCheck.php index b4627c4d1..d139baf1c 100644 --- a/app/Http/Middleware/InstalledCheck.php +++ b/app/Http/Middleware/InstalledCheck.php @@ -5,17 +5,18 @@ namespace App\Http\Middleware; +use App\Contracts\Middleware; use Closure; use Illuminate\Http\Request; -class InstalledCheck +/** + * Check the app.key to see whether we're installed or not + * + * If the default key is set and we're not in any of the installer routes + * show the message that we need to be installed + */ +class InstalledCheck implements Middleware { - /** - * Check the app.key to see whether we're installed or not - * - * If the default key is set and we're not in any of the installer routes - * show the message that we need to be installed - */ public function handle(Request $request, Closure $next) { if (config('app.key') === 'base64:zdgcDqu9PM8uGWCtMxd74ZqdGJIrnw812oRMmwDF6KY=' diff --git a/app/Http/Middleware/JsonResponse.php b/app/Http/Middleware/JsonResponse.php index 5ec027575..53b3f17d5 100644 --- a/app/Http/Middleware/JsonResponse.php +++ b/app/Http/Middleware/JsonResponse.php @@ -5,11 +5,13 @@ namespace App\Http\Middleware; +use App\Contracts\Middleware; use Closure; +use Illuminate\Http\Request; -class JsonResponse +class JsonResponse implements Middleware { - public function handle($request, Closure $next) + public function handle(Request $request, Closure $next) { $response = $next($request); $response->headers->set('Content-Type', 'application/json'); diff --git a/app/Http/Middleware/MeasureExecutionTime.php b/app/Http/Middleware/MeasureExecutionTime.php index 59139ce0c..2c9c5aaa9 100644 --- a/app/Http/Middleware/MeasureExecutionTime.php +++ b/app/Http/Middleware/MeasureExecutionTime.php @@ -5,19 +5,13 @@ namespace App\Http\Middleware; +use App\Contracts\Middleware; use Closure; +use Illuminate\Http\Request; -class MeasureExecutionTime +class MeasureExecutionTime implements Middleware { - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * - * @return mixed - */ - public function handle($request, Closure $next) + public function handle(Request $request, Closure $next) { // Get the response $response = $next($request); diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index abb8423b2..386ff05ea 100755 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -2,21 +2,14 @@ namespace App\Http\Middleware; +use App\Contracts\Middleware; use Closure; +use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; -class RedirectIfAuthenticated +class RedirectIfAuthenticated implements Middleware { - /** - * Handle an incoming request. - * - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * @param string|null $guard - * - * @return mixed - */ - public function handle($request, Closure $next, $guard = null) + public function handle(Request $request, Closure $next, $guard = null) { if (Auth::guard($guard)->check()) { return redirect('/'); diff --git a/app/Http/Middleware/SetActiveTheme.php b/app/Http/Middleware/SetActiveTheme.php index e6c872edf..9211bccfa 100644 --- a/app/Http/Middleware/SetActiveTheme.php +++ b/app/Http/Middleware/SetActiveTheme.php @@ -2,15 +2,17 @@ namespace App\Http\Middleware; +use App\Contracts\Middleware; use Closure; use Igaster\LaravelTheme\Facades\Theme; +use Illuminate\Http\Request; /** * Read the current theme from the settings (set in admin), and set it */ -class SetActiveTheme +class SetActiveTheme implements Middleware { - public function handle($request, Closure $next) + public function handle(Request $request, Closure $next) { $theme = setting('general.theme'); if (!empty($theme)) { diff --git a/app/Http/Middleware/UpdatePending.php b/app/Http/Middleware/UpdatePending.php index 18d3f5ec5..50eb81838 100644 --- a/app/Http/Middleware/UpdatePending.php +++ b/app/Http/Middleware/UpdatePending.php @@ -2,13 +2,15 @@ namespace App\Http\Middleware; +use App\Contracts\Middleware; use App\Services\Installer\InstallerService; use Closure; +use Illuminate\Http\Request; /** * Determine if an update is pending by checking in with the Installer service */ -class UpdatePending +class UpdatePending implements Middleware { private $installerSvc; @@ -17,13 +19,7 @@ public function __construct(InstallerService $installerSvc) $this->installerSvc = $installerSvc; } - /** - * @param \Illuminate\Http\Request $request - * @param \Closure $next - * - * @return mixed - */ - public function handle($request, Closure $next) + public function handle(Request $request, Closure $next) { if ($this->installerSvc->isUpgradePending()) { return redirect('/update/step1'); diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php index 9c26fd502..9046b1043 100755 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -2,9 +2,10 @@ namespace App\Http\Middleware; +use App\Contracts\Middleware; use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier; -class VerifyCsrfToken extends BaseVerifier +class VerifyCsrfToken extends BaseVerifier implements Middleware { /** * The URIs that should be excluded from CSRF verification. diff --git a/app/Models/Permission.php b/app/Models/Permission.php index beaa2e89c..94a893e96 100644 --- a/app/Models/Permission.php +++ b/app/Models/Permission.php @@ -4,6 +4,9 @@ use Laratrust\Models\LaratrustPermission; +/** + * @method static firstOrCreate(array $array, array $array1) + */ class Permission extends LaratrustPermission { } diff --git a/app/Models/Role.php b/app/Models/Role.php index 176165d73..b18a877e2 100644 --- a/app/Models/Role.php +++ b/app/Models/Role.php @@ -6,6 +6,8 @@ /** * @method static where(string $string, $group) + * @method static firstOrCreate(array $array, array $array1) + * @method static truncate() */ class Role extends LaratrustRole { diff --git a/app/Models/User.php b/app/Models/User.php index 69a1f67df..eae1e6b60 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -34,6 +34,10 @@ * @property int state * @property bool opt_in * @property string last_pirep_id + * + * @method static updateOrCreate(array $array, array $attrs) + * @method static where() + * @method static truncate() * @mixin \Illuminate\Notifications\Notifiable * @mixin \Laratrust\Traits\LaratrustUserTrait */ diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 08de6322b..9b3acf514 100755 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -26,8 +26,8 @@ use App\Repositories\SettingRepository; use App\Services\ModuleService; use Illuminate\Support\Facades\Schema; +use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; -use View; class AppServiceProvider extends ServiceProvider { diff --git a/app/Services/Finance/PirepFinanceService.php b/app/Services/Finance/PirepFinanceService.php index a34985d3b..2cd99bbc8 100644 --- a/app/Services/Finance/PirepFinanceService.php +++ b/app/Services/Finance/PirepFinanceService.php @@ -11,17 +11,16 @@ use App\Repositories\ExpenseRepository; use App\Repositories\JournalRepository; use App\Services\FareService; +use App\Services\FinanceService; use App\Support\Math; use App\Support\Money; use Illuminate\Support\Facades\Log; -/** - * Class FinanceService - */ class PirepFinanceService extends Service { private $expenseRepo; private $fareSvc; + private $financeSvc; private $journalRepo; /** @@ -30,15 +29,18 @@ class PirepFinanceService extends Service * @param ExpenseRepository $expenseRepo * @param FareService $fareSvc * @param JournalRepository $journalRepo + * @param FinanceService $financeSvc */ public function __construct( ExpenseRepository $expenseRepo, FareService $fareSvc, + FinanceService $financeSvc, JournalRepository $journalRepo ) { $this->expenseRepo = $expenseRepo; $this->fareSvc = $fareSvc; $this->journalRepo = $journalRepo; + $this->financeSvc = $financeSvc; } /** @@ -149,13 +151,11 @@ public function payFuelCosts(Pirep $pirep): void Log::info('Finance: Fuel cost, (fuel='.$fuel_used.', cost='.$ap->fuel_jeta_cost.') D=' .$debit->getAmount()); - $this->journalRepo->post( + $this->financeSvc->debitFromJournal( $pirep->airline->journal, - null, $debit, $pirep, 'Fuel Cost ('.$ap->fuel_jeta_cost.'/'.config('phpvms.internal_units.fuel').')', - null, 'Fuel', 'fuel' ); @@ -194,13 +194,11 @@ public function payExpensesForSubfleet(Pirep $pirep): void $debit = Money::createFromAmount($cost_per_min * $block_time); Log::info('Finance: Subfleet Block Hourly, D='.$debit->getAmount()); - $this->journalRepo->post( + $this->financeSvc->debitFromJournal( $pirep->airline->journal, - null, $debit, $pirep, 'Subfleet '.$sf->type.': Block Time Cost', - null, 'Subfleet '.$sf->type, 'subfleet' ); @@ -265,13 +263,11 @@ public function payExpensesForPirep(Pirep $pirep): void $journal = $pirep->user->journal; } - $this->journalRepo->post( + $this->financeSvc->debitFromJournal( $journal, - null, $debit, $pirep, $memo, - null, $transaction_group, strtolower($klass) ); @@ -320,13 +316,11 @@ public function payExpensesEventsForPirep(Pirep $pirep): void $debit = Money::createFromAmount($expense->amount); - $this->journalRepo->post( + $this->financeSvc->debitFromJournal( $pirep->airline->journal, - null, $debit, $pirep, 'Expense: '.$expense->name, - null, $expense->transaction_group ?? 'Expenses', 'expense' ); @@ -347,13 +341,12 @@ public function payGroundHandlingForPirep(Pirep $pirep): void { $ground_handling_cost = $this->getGroundHandlingCost($pirep); Log::info('Finance: PIREP: '.$pirep->id.'; ground handling: '.$ground_handling_cost); - $this->journalRepo->post( + + $this->financeSvc->debitFromJournal( $pirep->airline->journal, - null, Money::createFromAmount($ground_handling_cost), $pirep, 'Ground Handling', - null, 'Ground Handling', 'ground_handling' ); @@ -378,24 +371,20 @@ public function payPilotForPirep(Pirep $pirep): void Log::info('Finance: PIREP: '.$pirep->id .'; pilot pay: '.$pilot_pay_rate.', total: '.$pilot_pay); - $this->journalRepo->post( + $this->financeSvc->debitFromJournal( $pirep->airline->journal, - null, $pilot_pay, $pirep, $memo, - null, 'Pilot Pay', 'pilot_pay' ); - $this->journalRepo->post( + $this->financeSvc->creditToJournal( $pirep->user->journal, $pilot_pay, - null, $pirep, $memo, - null, 'Pilot Pay', 'pilot_pay' ); diff --git a/app/Services/Finance/RecurringFinanceService.php b/app/Services/Finance/RecurringFinanceService.php index ed5edf330..d5044f0ab 100644 --- a/app/Services/Finance/RecurringFinanceService.php +++ b/app/Services/Finance/RecurringFinanceService.php @@ -8,23 +8,22 @@ use App\Models\Expense; use App\Models\JournalTransaction; use App\Repositories\JournalRepository; +use App\Services\FinanceService; use App\Support\Money; -use Log; +use Carbon\Carbon; +use Illuminate\Support\Facades\Log; /** * Process all of the daily expenses and charge them */ class RecurringFinanceService extends Service { + private $financeSvc; private $journalRepo; - /** - * RecurringFinanceService constructor. - * - * @param JournalRepository $journalRepo - */ - public function __construct(JournalRepository $journalRepo) + public function __construct(JournalRepository $journalRepo, FinanceService $financeSvc) { + $this->financeSvc = $financeSvc; $this->journalRepo = $journalRepo; } @@ -87,10 +86,8 @@ protected function getMemoAndGroup(Expense $expense): array /** * Run all of the daily expense/financials * - * @param int $type + * @param string $type * - * @throws \UnexpectedValueException - * @throws \InvalidArgumentException * @throws \Prettus\Validator\Exceptions\ValidatorException */ public function processExpenses($type = ExpenseType::DAILY): void @@ -101,7 +98,7 @@ public function processExpenses($type = ExpenseType::DAILY): void if ($type === ExpenseType::DAILY) { $tag = 'expenses_daily'; } elseif ($type === ExpenseType::MONTHLY) { - $tag === 'expenses_monthly'; + $tag = 'expenses_monthly'; } /** @@ -122,7 +119,7 @@ public function processExpenses($type = ExpenseType::DAILY): void ]; $found = JournalTransaction::where($w) - ->whereDate('post_date', '=', \Carbon::now('UTC')->toDateString()) + ->whereDate('post_date', '=', Carbon::now('UTC')->toDateString()) ->count(['id']); if ($found > 0) { @@ -132,13 +129,11 @@ public function processExpenses($type = ExpenseType::DAILY): void [$memo, $ta_group] = $this->getMemoAndGroup($expense); - $this->journalRepo->post( + $this->financeSvc->debitFromJournal( $journal, - null, Money::createFromAmount($amount), $expense, $memo, - null, $ta_group, $tag ); diff --git a/app/Services/FinanceService.php b/app/Services/FinanceService.php index 4ad60c1a5..ac0220ec3 100644 --- a/app/Services/FinanceService.php +++ b/app/Services/FinanceService.php @@ -4,11 +4,93 @@ use App\Contracts\Service; use App\Models\Airline; +use App\Models\Journal; use App\Models\JournalTransaction; +use App\Repositories\JournalRepository; use App\Support\Money; class FinanceService extends Service { + private $journalRepo; + + public function __construct(JournalRepository $journalRepo) + { + $this->journalRepo = $journalRepo; + } + + /** + * Credit some amount to a given journal + * E.g, some amount for expenses or ground handling fees, etc. Example, to pay a user a dollar + * for a pirep: + * + * creditToJournal($user->journal, new Money(1000), $pirep, 'Payment', 'pirep', 'payment'); + * + * @param \App\Models\Journal $journal + * @param Money $amount + * @param \Illuminate\Database\Eloquent\Model $reference + * @param string $memo + * @param string $transaction_group + * @param string|array $tag + * + * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return mixed + */ + public function creditToJournal( + Journal $journal, + Money $amount, + $reference, + $memo, + $transaction_group, + $tag + ) { + return $this->journalRepo->post( + $journal, + $amount, + null, + $reference, + $memo, + null, + $transaction_group, + $tag + ); + } + + /** + * Charge some expense for a given PIREP to the airline its file against + * E.g, some amount for expenses or ground handling fees, etc. + * + * @param \App\Models\Journal $journal + * @param Money $amount + * @param \Illuminate\Database\Eloquent\Model $reference + * @param string $memo + * @param string $transaction_group + * @param string|array $tag + * + * @throws \Prettus\Validator\Exceptions\ValidatorException + * + * @return mixed + */ + public function debitFromJournal( + Journal $journal, + Money $amount, + $reference, + $memo, + $transaction_group, + $tag + ) { + return $this->journalRepo->post( + $journal, + null, + $amount, + $reference, + $memo, + null, + $transaction_group, + $tag + ); + } + /** * Get all of the transactions for an airline between two given dates. Returns an array * with `credits`, `debits` and `transactions` fields, where transactions contains the diff --git a/app/Services/Installer/SeederService.php b/app/Services/Installer/SeederService.php index 2ae2fed94..52ef793b3 100644 --- a/app/Services/Installer/SeederService.php +++ b/app/Services/Installer/SeederService.php @@ -236,6 +236,15 @@ private function settingsSeedsPending(): bool return true; } + // See if any of these column values have changed + foreach (['name', 'description'] as $column) { + $currVal = $row->{$column}; + $newVal = $setting[$column]; + if ($currVal !== $newVal) { + return true; + } + } + // See if any of the options have changed if ($row->type === 'select') { if ($row->options !== $setting['options']) { @@ -259,10 +268,20 @@ private function permissionsSeedsPending(): bool $yml = Yaml::parse($data); foreach ($yml as $perm) { - $count = DB::table('permissions')->where('name', $perm['name'])->count('name'); - if ($count === 0) { + $row = DB::table('permissions') + ->where('name', $perm['name']) + ->first(); + + if (!$row) { return true; } + + // See if any of these column values have changed + foreach (['display_name', 'description'] as $column) { + if ($row->{$column} !== $perm[$column]) { + return true; + } + } } return false; diff --git a/app/Services/RoleService.php b/app/Services/RoleService.php new file mode 100644 index 000000000..1b6c00588 --- /dev/null +++ b/app/Services/RoleService.php @@ -0,0 +1,47 @@ +roleRepo = $roleRepo; + } + + /** + * Update a role with the given attributes + * + * @param Role $role + * @param array $attrs + * + * @return Role + */ + public function updateRole(Role $role, array $attrs) + { + $role->update($attrs); + $role->save(); + + return $role; + } + + /** + * @param Role $role + * @param array $permissions + */ + public function setPermissionsForRole(Role $role, array $permissions) + { + // Update the permissions, filter out null/invalid values + $perms = collect($permissions)->filter(static function ($v, $k) { + return $v; + }); + + $role->permissions()->sync($perms); + } +} diff --git a/app/Services/UserService.php b/app/Services/UserService.php index bc233a7ab..07c2481c2 100644 --- a/app/Services/UserService.php +++ b/app/Services/UserService.php @@ -48,14 +48,14 @@ public function __construct( * Register a pilot. Also attaches the initial roles * required, and then triggers the UserRegistered event * - * @param User $user User model - * @param array $groups Additional groups to assign + * @param User $user User model + * @param array $roles List of "display_name" of groups to assign * * @throws \Exception * * @return mixed */ - public function createUser(User $user, array $groups = null) + public function createUser(User $user, array $roles = null) { // Determine if we want to auto accept if (setting('pilots.auto_accept') === true) { @@ -66,15 +66,10 @@ public function createUser(User $user, array $groups = null) $user->save(); - // Attach the user roles - // $role = Role::where('name', 'user')->first(); - // $user->attachRole($role); - // Attach any additional roles - if (!empty($groups) && is_array($groups)) { - foreach ($groups as $group) { - $role = Role::where('name', $group)->first(); - $user->attachRole($role); + if (!empty($roles) && is_array($roles)) { + foreach ($roles as $role) { + $this->addUserToRole($user, $role); } } @@ -87,6 +82,32 @@ public function createUser(User $user, array $groups = null) return $user; } + /** + * Add a user to a given role + * + * @param User $user + * @param string $roleName + * + * @return User + */ + public function addUserToRole(User $user, $roleName): User + { + $role = Role::where('name', $roleName)->first(); + $user->attachRole($role); + + return $user; + } + + /** + * Find and return the next available pilot ID (usually just the max+1) + * + * @return int + */ + public function getNextAvailablePilotId(): int + { + return (int) User::max('pilot_id') + 1; + } + /** * Find the next available pilot ID and set the current user's pilot_id to that +1 * Called from UserObserver right now after a record is created @@ -101,8 +122,7 @@ public function findAndSetPilotId(User $user): User return $user; } - $max = (int) User::max('pilot_id'); - $user->pilot_id = $max + 1; + $user->pilot_id = $this->getNextAvailablePilotId(); $user->save(); Log::info('Set pilot ID for user '.$user->id.' to '.$user->pilot_id); @@ -348,8 +368,8 @@ public function recalculateStats(User $user): User 'state' => PirepState::ACCEPTED, ]; - $flight_count = Pirep::where($w)->count(); - $user->flights = $flight_count; + $pirep_count = Pirep::where($w)->count(); + $user->flights = $pirep_count; $flight_time = Pirep::where($w)->sum('flight_time'); $user->flight_time = $flight_time; @@ -359,7 +379,7 @@ public function recalculateStats(User $user): User // Recalc the rank $this->calculatePilotRank($user); - Log::info('User '.$user->ident.' updated; flight count='.$flight_count + Log::info('User '.$user->ident.' updated; pirep count='.$pirep_count .', rank='.$user->rank->name .', flight_time='.$user->flight_time.' minutes'); diff --git a/app/Support/Utils.php b/app/Support/Utils.php new file mode 100644 index 000000000..cd371d7cc --- /dev/null +++ b/app/Support/Utils.php @@ -0,0 +1,27 @@ +isEnabled(); + } +} diff --git a/composer.json b/composer.json index 9e77c32c4..b5d52674b 100755 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "markrogoyski/math-php": "^0.38.0", "myclabs/deep-copy": "~1.9.0", "nabeel/vacentral": "~2.0", - "nwidart/laravel-modules": "~5.1", + "nwidart/laravel-modules": "^6.0", "php-units-of-measure/php-units-of-measure": "~2.1.0", "pragmarx/version": "0.2.*", "prettus/l5-repository": "~2.6.0", diff --git a/composer.lock b/composer.lock index 8ca95243e..1c8d6de79 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "646a110be5a7dc5a530dd8f6f634a5de", + "content-hash": "de3570051ae52b54dc313e93abcfc877", "packages": [ { "name": "akaunting/money", @@ -816,24 +816,24 @@ }, { "name": "composer/xdebug-handler", - "version": "1.3.3", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "46867cbf8ca9fb8d60c506895449eb799db1184f" + "reference": "cbe23383749496fe0f373345208b79568e4bc248" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/46867cbf8ca9fb8d60c506895449eb799db1184f", - "reference": "46867cbf8ca9fb8d60c506895449eb799db1184f", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/cbe23383749496fe0f373345208b79568e4bc248", + "reference": "cbe23383749496fe0f373345208b79568e4bc248", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0", + "php": "^5.3.2 || ^7.0 || ^8.0", "psr/log": "^1.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" }, "type": "library", "autoload": { @@ -851,25 +851,25 @@ "email": "john-stevenson@blueyonder.co.uk" } ], - "description": "Restarts a process without xdebug.", + "description": "Restarts a process without Xdebug.", "keywords": [ "Xdebug", "performance" ], - "time": "2019-05-27T17:52:04+00:00" + "time": "2019-11-06T16:40:04+00:00" }, { "name": "doctrine/cache", - "version": "v1.8.1", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "d4374ae95b36062d02ef310100ed33d78738d76c" + "reference": "89a5c76c39c292f7798f964ab3c836c3f8192a55" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/d4374ae95b36062d02ef310100ed33d78738d76c", - "reference": "d4374ae95b36062d02ef310100ed33d78738d76c", + "url": "https://api.github.com/repos/doctrine/cache/zipball/89a5c76c39c292f7798f964ab3c836c3f8192a55", + "reference": "89a5c76c39c292f7798f964ab3c836c3f8192a55", "shasum": "" }, "require": { @@ -880,7 +880,7 @@ }, "require-dev": { "alcaeus/mongo-php-adapter": "^1.1", - "doctrine/coding-standard": "^4.0", + "doctrine/coding-standard": "^6.0", "mongodb/mongodb": "^1.1", "phpunit/phpunit": "^7.0", "predis/predis": "~1.0" @@ -891,7 +891,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8.x-dev" + "dev-master": "1.9.x-dev" } }, "autoload": { @@ -925,26 +925,34 @@ "email": "schmittjoh@gmail.com" } ], - "description": "Caching library offering an object-oriented API for many cache backends", - "homepage": "https://www.doctrine-project.org", + "description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.", + "homepage": "https://www.doctrine-project.org/projects/cache.html", "keywords": [ + "abstraction", + "apcu", "cache", - "caching" + "caching", + "couchdb", + "memcached", + "php", + "redis", + "riak", + "xcache" ], - "time": "2019-10-28T09:31:32+00:00" + "time": "2019-11-15T14:31:57+00:00" }, { "name": "doctrine/dbal", - "version": "v2.9.2", + "version": "v2.9.3", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "22800bd651c1d8d2a9719e2a3dc46d5108ebfcc9" + "reference": "7345cd59edfa2036eb0fa4264b77ae2576842035" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/22800bd651c1d8d2a9719e2a3dc46d5108ebfcc9", - "reference": "22800bd651c1d8d2a9719e2a3dc46d5108ebfcc9", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/7345cd59edfa2036eb0fa4264b77ae2576842035", + "reference": "7345cd59edfa2036eb0fa4264b77ae2576842035", "shasum": "" }, "require": { @@ -984,6 +992,10 @@ "MIT" ], "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -992,10 +1004,6 @@ "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, { "name": "Jonathan Wage", "email": "jonwage@gmail.com" @@ -1013,20 +1021,20 @@ "php", "queryobject" ], - "time": "2018-12-31T03:27:51+00:00" + "time": "2019-11-02T22:19:34+00:00" }, { "name": "doctrine/event-manager", - "version": "v1.0.0", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/event-manager.git", - "reference": "a520bc093a0170feeb6b14e9d83f3a14452e64b3" + "reference": "629572819973f13486371cb611386eb17851e85c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/a520bc093a0170feeb6b14e9d83f3a14452e64b3", - "reference": "a520bc093a0170feeb6b14e9d83f3a14452e64b3", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/629572819973f13486371cb611386eb17851e85c", + "reference": "629572819973f13486371cb611386eb17851e85c", "shasum": "" }, "require": { @@ -1036,7 +1044,7 @@ "doctrine/common": "<2.9@dev" }, "require-dev": { - "doctrine/coding-standard": "^4.0", + "doctrine/coding-standard": "^6.0", "phpunit/phpunit": "^7.0" }, "type": "library", @@ -1055,6 +1063,10 @@ "MIT" ], "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -1063,10 +1075,6 @@ "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, { "name": "Jonathan Wage", "email": "jonwage@gmail.com" @@ -1080,27 +1088,29 @@ "email": "ocramius@gmail.com" } ], - "description": "Doctrine Event Manager component", + "description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.", "homepage": "https://www.doctrine-project.org/projects/event-manager.html", "keywords": [ "event", - "eventdispatcher", - "eventmanager" + "event dispatcher", + "event manager", + "event system", + "events" ], - "time": "2018-06-11T11:59:03+00:00" + "time": "2019-11-10T09:48:07+00:00" }, { "name": "doctrine/inflector", - "version": "v1.3.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/doctrine/inflector.git", - "reference": "5527a48b7313d15261292c149e55e26eae771b0a" + "reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/inflector/zipball/5527a48b7313d15261292c149e55e26eae771b0a", - "reference": "5527a48b7313d15261292c149e55e26eae771b0a", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/ec3a55242203ffa6a4b27c58176da97ff0a7aec1", + "reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1", "shasum": "" }, "require": { @@ -1120,11 +1130,15 @@ "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -1133,10 +1147,6 @@ "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, { "name": "Jonathan Wage", "email": "jonwage@gmail.com" @@ -1154,20 +1164,20 @@ "singularize", "string" ], - "time": "2018-01-09T20:05:19+00:00" + "time": "2019-10-30T19:59:35+00:00" }, { "name": "doctrine/lexer", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "e17f069ede36f7534b95adec71910ed1b49c74ea" + "reference": "5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/e17f069ede36f7534b95adec71910ed1b49c74ea", - "reference": "e17f069ede36f7534b95adec71910ed1b49c74ea", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6", + "reference": "5242d66dbeb21a30dd8a3e66bf7a73b66e05e1f6", "shasum": "" }, "require": { @@ -1181,7 +1191,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -1216,7 +1226,7 @@ "parser", "php" ], - "time": "2019-07-30T19:33:28+00:00" + "time": "2019-10-30T14:39:59+00:00" }, { "name": "dragonmantank/cron-expression", @@ -1435,16 +1445,16 @@ }, { "name": "facade/flare-client-php", - "version": "1.1.1", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/facade/flare-client-php.git", - "reference": "608c2be3157b09f1868ca97ea4ddf3434ee83d63" + "reference": "5a1bfe4425974d17addeefce737d66a4c921a8df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facade/flare-client-php/zipball/608c2be3157b09f1868ca97ea4ddf3434ee83d63", - "reference": "608c2be3157b09f1868ca97ea4ddf3434ee83d63", + "url": "https://api.github.com/repos/facade/flare-client-php/zipball/5a1bfe4425974d17addeefce737d66a4c921a8df", + "reference": "5a1bfe4425974d17addeefce737d66a4c921a8df", "shasum": "" }, "require": { @@ -1485,20 +1495,20 @@ "flare", "reporting" ], - "time": "2019-10-07T19:15:46+00:00" + "time": "2019-11-19T08:42:39+00:00" }, { "name": "facade/ignition", - "version": "1.11.2", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/facade/ignition.git", - "reference": "862cbc2dfffa1fa28b47822a116e5b2e03b421db" + "reference": "6a1d324e8362b8818b0ec65994a9d71a7bd94964" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facade/ignition/zipball/862cbc2dfffa1fa28b47822a116e5b2e03b421db", - "reference": "862cbc2dfffa1fa28b47822a116e5b2e03b421db", + "url": "https://api.github.com/repos/facade/ignition/zipball/6a1d324e8362b8818b0ec65994a9d71a7bd94964", + "reference": "6a1d324e8362b8818b0ec65994a9d71a7bd94964", "shasum": "" }, "require": { @@ -1556,7 +1566,7 @@ "laravel", "page" ], - "time": "2019-10-13T10:42:06+00:00" + "time": "2019-11-25T15:24:39+00:00" }, { "name": "facade/ignition-contracts", @@ -2367,16 +2377,16 @@ }, { "name": "laravel/framework", - "version": "v6.4.1", + "version": "v6.5.2", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "ebd8fcc038effa8c5f8791346c48047f7d0ed320" + "reference": "cca8906654e72d7bb118c3c18bb55e74c109a766" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/ebd8fcc038effa8c5f8791346c48047f7d0ed320", - "reference": "ebd8fcc038effa8c5f8791346c48047f7d0ed320", + "url": "https://api.github.com/repos/laravel/framework/zipball/cca8906654e72d7bb118c3c18bb55e74c109a766", + "reference": "cca8906654e72d7bb118c3c18bb55e74c109a766", "shasum": "" }, "require": { @@ -2509,7 +2519,7 @@ "framework", "laravel" ], - "time": "2019-10-29T14:30:39+00:00" + "time": "2019-11-19T14:52:01+00:00" }, { "name": "laravel/helpers", @@ -2978,16 +2988,16 @@ }, { "name": "monolog/monolog", - "version": "2.0.0", + "version": "2.0.1", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "68545165e19249013afd1d6f7485aecff07a2d22" + "reference": "f9d56fd2f5533322caccdfcddbb56aedd622ef1c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/68545165e19249013afd1d6f7485aecff07a2d22", - "reference": "68545165e19249013afd1d6f7485aecff07a2d22", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f9d56fd2f5533322caccdfcddbb56aedd622ef1c", + "reference": "f9d56fd2f5533322caccdfcddbb56aedd622ef1c", "shasum": "" }, "require": { @@ -3055,7 +3065,7 @@ "logging", "psr-3" ], - "time": "2019-08-30T09:56:44+00:00" + "time": "2019-11-13T10:27:43+00:00" }, { "name": "myclabs/deep-copy", @@ -3144,22 +3154,22 @@ }, { "name": "nesbot/carbon", - "version": "2.25.3", + "version": "2.27.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "d07636581795383e2fea2d711212d30f941f2039" + "reference": "13b8485a8690f103bf19cba64879c218b102b726" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/d07636581795383e2fea2d711212d30f941f2039", - "reference": "d07636581795383e2fea2d711212d30f941f2039", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/13b8485a8690f103bf19cba64879c218b102b726", + "reference": "13b8485a8690f103bf19cba64879c218b102b726", "shasum": "" }, "require": { "ext-json": "*", "php": "^7.1.8 || ^8.0", - "symfony/translation": "^3.4 || ^4.0" + "symfony/translation": "^3.4 || ^4.0 || ^5.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^2.14 || ^3.0", @@ -3174,6 +3184,9 @@ ], "type": "library", "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + }, "laravel": { "providers": [ "Carbon\\Laravel\\ServiceProvider" @@ -3207,20 +3220,20 @@ "datetime", "time" ], - "time": "2019-10-20T11:05:44+00:00" + "time": "2019-11-20T06:59:06+00:00" }, { "name": "nikic/php-parser", - "version": "v4.2.5", + "version": "v4.3.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "b76bbc3c51f22c570648de48e8c2d941ed5e2cf2" + "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/b76bbc3c51f22c570648de48e8c2d941ed5e2cf2", - "reference": "b76bbc3c51f22c570648de48e8c2d941ed5e2cf2", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/9a9981c347c5c49d6dfe5cf826bb882b824080dc", + "reference": "9a9981c347c5c49d6dfe5cf826bb882b824080dc", "shasum": "" }, "require": { @@ -3228,7 +3241,7 @@ "php": ">=7.0" }, "require-dev": { - "ircmaxell/php-yacc": "0.0.4", + "ircmaxell/php-yacc": "0.0.5", "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0" }, "bin": [ @@ -3237,7 +3250,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.2-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -3259,30 +3272,31 @@ "parser", "php" ], - "time": "2019-10-25T18:33:07+00:00" + "time": "2019-11-08T13:50:10+00:00" }, { "name": "nwidart/laravel-modules", - "version": "5.1.0", + "version": "6.2.0", "source": { "type": "git", "url": "https://github.com/nWidart/laravel-modules.git", - "reference": "d4edc3465d471644ca44b1b303803492609957cd" + "reference": "6dc702eeb5d025b4cd331bc394e47ccc43b68e89" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nWidart/laravel-modules/zipball/d4edc3465d471644ca44b1b303803492609957cd", - "reference": "d4edc3465d471644ca44b1b303803492609957cd", + "url": "https://api.github.com/repos/nWidart/laravel-modules/zipball/6dc702eeb5d025b4cd331bc394e47ccc43b68e89", + "reference": "6dc702eeb5d025b4cd331bc394e47ccc43b68e89", "shasum": "" }, "require": { + "ext-json": "*", "php": ">=7.2" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.14", - "laravel/framework": "5.8.*", + "friendsofphp/php-cs-fixer": "^2.15", + "laravel/framework": "6.0.*", "mockery/mockery": "~1.0", - "orchestra/testbench": "^3.8", + "orchestra/testbench": "^4.0", "phpstan/phpstan": "^0.9.2", "phpunit/phpunit": "~7.0|~8.0", "spatie/phpunit-snapshot-assertions": "^2.1.0" @@ -3298,7 +3312,7 @@ } }, "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "6.0-dev" } }, "autoload": { @@ -3329,7 +3343,7 @@ "nwidart", "rad" ], - "time": "2019-09-05T09:41:08+00:00" + "time": "2019-11-12T18:38:48+00:00" }, { "name": "opis/closure", @@ -3555,28 +3569,28 @@ }, { "name": "phpoption/phpoption", - "version": "1.5.0", + "version": "1.5.2", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed" + "reference": "2ba2586380f8d2b44ad1b9feb61c371020b27793" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/94e644f7d2051a5f0fcf77d81605f152eecff0ed", - "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/2ba2586380f8d2b44ad1b9feb61c371020b27793", + "reference": "2ba2586380f8d2b44ad1b9feb61c371020b27793", "shasum": "" }, "require": { "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "4.7.*" + "phpunit/phpunit": "^4.7|^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.5-dev" } }, "autoload": { @@ -3586,7 +3600,7 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "Apache2" + "Apache-2.0" ], "authors": [ { @@ -3601,7 +3615,7 @@ "php", "type" ], - "time": "2015-07-25T16:39:46+00:00" + "time": "2019-11-06T22:27:00+00:00" }, { "name": "pragmarx/version", @@ -3979,16 +3993,16 @@ }, { "name": "psr/log", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "bf73deb2b3b896a9d9c75f3f0d88185d2faa27e2" + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/bf73deb2b3b896a9d9c75f3f0d88185d2faa27e2", - "reference": "bf73deb2b3b896a9d9c75f3f0d88185d2faa27e2", + "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", "shasum": "" }, "require": { @@ -4022,7 +4036,7 @@ "psr", "psr-3" ], - "time": "2019-10-25T08:06:51+00:00" + "time": "2019-11-01T11:05:21+00:00" }, { "name": "psr/simple-cache", @@ -4284,16 +4298,16 @@ }, { "name": "santigarcor/laratrust", - "version": "5.2.5", + "version": "5.2.6", "source": { "type": "git", "url": "https://github.com/santigarcor/laratrust.git", - "reference": "084cf15a0710657c203616f27309971f8a38ccd3" + "reference": "8efac1ee9cc7750c9207e521776a9adbc35ce307" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/santigarcor/laratrust/zipball/084cf15a0710657c203616f27309971f8a38ccd3", - "reference": "084cf15a0710657c203616f27309971f8a38ccd3", + "url": "https://api.github.com/repos/santigarcor/laratrust/zipball/8efac1ee9cc7750c9207e521776a9adbc35ce307", + "reference": "8efac1ee9cc7750c9207e521776a9adbc35ce307", "shasum": "" }, "require": { @@ -4345,7 +4359,7 @@ "rbac", "roles" ], - "time": "2019-10-22T14:41:04+00:00" + "time": "2019-11-08T13:53:13+00:00" }, { "name": "scrivo/highlight.php", @@ -4624,16 +4638,16 @@ }, { "name": "spatie/db-dumper", - "version": "2.14.3", + "version": "2.15.0", "source": { "type": "git", "url": "https://github.com/spatie/db-dumper.git", - "reference": "0ea605041373dce22cd0a387bca598050c7d033b" + "reference": "ccb7dd7557cd119b21ea853a893da4d1b0ff08b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/db-dumper/zipball/0ea605041373dce22cd0a387bca598050c7d033b", - "reference": "0ea605041373dce22cd0a387bca598050c7d033b", + "url": "https://api.github.com/repos/spatie/db-dumper/zipball/ccb7dd7557cd119b21ea853a893da4d1b0ff08b6", + "reference": "ccb7dd7557cd119b21ea853a893da4d1b0ff08b6", "shasum": "" }, "require": { @@ -4656,9 +4670,9 @@ "authors": [ { "name": "Freek Van der Herten", - "role": "Developer", "email": "freek@spatie.be", - "homepage": "https://spatie.be" + "homepage": "https://spatie.be", + "role": "Developer" } ], "description": "Dump databases", @@ -4670,20 +4684,20 @@ "mysqldump", "spatie" ], - "time": "2019-08-21T16:39:54+00:00" + "time": "2019-11-11T10:40:42+00:00" }, { "name": "spatie/laravel-backup", - "version": "6.7.2", + "version": "6.7.4", "source": { "type": "git", "url": "https://github.com/spatie/laravel-backup.git", - "reference": "ab48ebb31388e004dfac9d6203033e29db9a24a9" + "reference": "e3ea9bc9994be5cf8d9e10b202ed838380e0b4e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-backup/zipball/ab48ebb31388e004dfac9d6203033e29db9a24a9", - "reference": "ab48ebb31388e004dfac9d6203033e29db9a24a9", + "url": "https://api.github.com/repos/spatie/laravel-backup/zipball/e3ea9bc9994be5cf8d9e10b202ed838380e0b4e4", + "reference": "e3ea9bc9994be5cf8d9e10b202ed838380e0b4e4", "shasum": "" }, "require": { @@ -4745,7 +4759,7 @@ "laravel-backup", "spatie" ], - "time": "2019-10-29T03:46:02+00:00" + "time": "2019-11-07T22:11:24+00:00" }, { "name": "spatie/temporary-directory", @@ -4848,16 +4862,16 @@ }, { "name": "swiftmailer/swiftmailer", - "version": "v6.2.1", + "version": "v6.2.3", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "5397cd05b0a0f7937c47b0adcb4c60e5ab936b6a" + "reference": "149cfdf118b169f7840bbe3ef0d4bc795d1780c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/5397cd05b0a0f7937c47b0adcb4c60e5ab936b6a", - "reference": "5397cd05b0a0f7937c47b0adcb4c60e5ab936b6a", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/149cfdf118b169f7840bbe3ef0d4bc795d1780c9", + "reference": "149cfdf118b169f7840bbe3ef0d4bc795d1780c9", "shasum": "" }, "require": { @@ -4906,31 +4920,32 @@ "mail", "mailer" ], - "time": "2019-04-21T09:21:45+00:00" + "time": "2019-11-12T09:31:26+00:00" }, { "name": "symfony/console", - "version": "v4.3.5", + "version": "v4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "929ddf360d401b958f611d44e726094ab46a7369" + "reference": "35d9077f495c6d184d9930f7a7ecbd1ad13c7ab8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/929ddf360d401b958f611d44e726094ab46a7369", - "reference": "929ddf360d401b958f611d44e726094ab46a7369", + "url": "https://api.github.com/repos/symfony/console/zipball/35d9077f495c6d184d9930f7a7ecbd1ad13c7ab8", + "reference": "35d9077f495c6d184d9930f7a7ecbd1ad13c7ab8", "shasum": "" }, "require": { "php": "^7.1.3", "symfony/polyfill-mbstring": "~1.0", "symfony/polyfill-php73": "^1.8", - "symfony/service-contracts": "^1.1" + "symfony/service-contracts": "^1.1|^2" }, "conflict": { "symfony/dependency-injection": "<3.4", - "symfony/event-dispatcher": "<4.3", + "symfony/event-dispatcher": "<4.3|>=5", + "symfony/lock": "<4.4", "symfony/process": "<3.3" }, "provide": { @@ -4938,12 +4953,12 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", "symfony/event-dispatcher": "^4.3", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0", - "symfony/var-dumper": "^4.3" + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^3.4|^4.0|^5.0", + "symfony/var-dumper": "^4.3|^5.0" }, "suggest": { "psr/log": "For using the console logger", @@ -4954,7 +4969,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -4981,29 +4996,29 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-10-07T12:36:49+00:00" + "time": "2019-11-13T07:39:40+00:00" }, { "name": "symfony/css-selector", - "version": "v4.3.5", + "version": "v5.0.0", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9" + "reference": "19d29e7098b7b2c3313cb03902ca30f100dcb837" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9", - "reference": "f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/19d29e7098b7b2c3313cb03902ca30f100dcb837", + "reference": "19d29e7098b7b2c3313cb03902ca30f100dcb837", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^7.2.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -5034,20 +5049,20 @@ ], "description": "Symfony CssSelector Component", "homepage": "https://symfony.com", - "time": "2019-10-02T08:36:26+00:00" + "time": "2019-11-18T17:27:11+00:00" }, { "name": "symfony/debug", - "version": "v4.3.5", + "version": "v4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "cc5c1efd0edfcfd10b354750594a46b3dd2afbbe" + "reference": "b24b791f817116b29e52a63e8544884cf9a40757" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/cc5c1efd0edfcfd10b354750594a46b3dd2afbbe", - "reference": "cc5c1efd0edfcfd10b354750594a46b3dd2afbbe", + "url": "https://api.github.com/repos/symfony/debug/zipball/b24b791f817116b29e52a63e8544884cf9a40757", + "reference": "b24b791f817116b29e52a63e8544884cf9a40757", "shasum": "" }, "require": { @@ -5058,12 +5073,12 @@ "symfony/http-kernel": "<3.4" }, "require-dev": { - "symfony/http-kernel": "~3.4|~4.0" + "symfony/http-kernel": "^3.4|^4.0|^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -5090,20 +5105,76 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2019-09-19T15:51:53+00:00" + "time": "2019-11-10T17:54:30+00:00" + }, + { + "name": "symfony/error-handler", + "version": "v4.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/error-handler.git", + "reference": "e1acb58dc6a8722617fe56565f742bcf7e8744bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/e1acb58dc6a8722617fe56565f742bcf7e8744bf", + "reference": "e1acb58dc6a8722617fe56565f742bcf7e8744bf", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "psr/log": "~1.0", + "symfony/debug": "^4.4", + "symfony/var-dumper": "^4.4|^5.0" + }, + "require-dev": { + "symfony/http-kernel": "^4.4|^5.0", + "symfony/serializer": "^4.4|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\ErrorHandler\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony ErrorHandler Component", + "homepage": "https://symfony.com", + "time": "2019-11-17T22:49:13+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v4.3.5", + "version": "v4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "6229f58993e5a157f6096fc7145c0717d0be8807" + "reference": "ab1c43e17fff802bef0a898f3bc088ac33b8e0e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/6229f58993e5a157f6096fc7145c0717d0be8807", - "reference": "6229f58993e5a157f6096fc7145c0717d0be8807", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/ab1c43e17fff802bef0a898f3bc088ac33b8e0e1", + "reference": "ab1c43e17fff802bef0a898f3bc088ac33b8e0e1", "shasum": "" }, "require": { @@ -5119,12 +5190,12 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/expression-language": "~3.4|~4.0", - "symfony/http-foundation": "^3.4|^4.0", - "symfony/service-contracts": "^1.1", - "symfony/stopwatch": "~3.4|~4.0" + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/expression-language": "^3.4|^4.0|^5.0", + "symfony/http-foundation": "^3.4|^4.0|^5.0", + "symfony/service-contracts": "^1.1|^2", + "symfony/stopwatch": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/dependency-injection": "", @@ -5133,7 +5204,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -5160,7 +5231,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2019-10-01T16:40:32+00:00" + "time": "2019-11-08T22:40:51+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -5222,16 +5293,16 @@ }, { "name": "symfony/filesystem", - "version": "v4.3.5", + "version": "v4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "9abbb7ef96a51f4d7e69627bc6f63307994e4263" + "reference": "d12b01cba60be77b583c9af660007211e3909854" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/9abbb7ef96a51f4d7e69627bc6f63307994e4263", - "reference": "9abbb7ef96a51f4d7e69627bc6f63307994e4263", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/d12b01cba60be77b583c9af660007211e3909854", + "reference": "d12b01cba60be77b583c9af660007211e3909854", "shasum": "" }, "require": { @@ -5241,7 +5312,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -5268,20 +5339,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2019-08-20T14:07:54+00:00" + "time": "2019-11-12T14:51:11+00:00" }, { "name": "symfony/finder", - "version": "v4.3.5", + "version": "v4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "5e575faa95548d0586f6bedaeabec259714e44d1" + "reference": "ce8743441da64c41e2a667b8eb66070444ed911e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/5e575faa95548d0586f6bedaeabec259714e44d1", - "reference": "5e575faa95548d0586f6bedaeabec259714e44d1", + "url": "https://api.github.com/repos/symfony/finder/zipball/ce8743441da64c41e2a667b8eb66070444ed911e", + "reference": "ce8743441da64c41e2a667b8eb66070444ed911e", "shasum": "" }, "require": { @@ -5290,7 +5361,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -5317,35 +5388,35 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2019-09-16T11:29:48+00:00" + "time": "2019-11-17T21:56:56+00:00" }, { "name": "symfony/http-foundation", - "version": "v4.3.5", + "version": "v4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "76590ced16d4674780863471bae10452b79210a5" + "reference": "502040dd2b0cf0a292defeb6145f4d7a4753c99c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/76590ced16d4674780863471bae10452b79210a5", - "reference": "76590ced16d4674780863471bae10452b79210a5", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/502040dd2b0cf0a292defeb6145f4d7a4753c99c", + "reference": "502040dd2b0cf0a292defeb6145f4d7a4753c99c", "shasum": "" }, "require": { "php": "^7.1.3", - "symfony/mime": "^4.3", + "symfony/mime": "^4.3|^5.0", "symfony/polyfill-mbstring": "~1.1" }, "require-dev": { "predis/predis": "~1.0", - "symfony/expression-language": "~3.4|~4.0" + "symfony/expression-language": "^3.4|^4.0|^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -5372,37 +5443,37 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2019-10-04T19:48:13+00:00" + "time": "2019-11-17T10:10:42+00:00" }, { "name": "symfony/http-kernel", - "version": "v4.3.5", + "version": "v4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "5f08141850932e8019c01d8988bf3ed6367d2991" + "reference": "5a5e7237d928aa98ff8952050cbbf0135899b6b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/5f08141850932e8019c01d8988bf3ed6367d2991", - "reference": "5f08141850932e8019c01d8988bf3ed6367d2991", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/5a5e7237d928aa98ff8952050cbbf0135899b6b0", + "reference": "5a5e7237d928aa98ff8952050cbbf0135899b6b0", "shasum": "" }, "require": { "php": "^7.1.3", "psr/log": "~1.0", - "symfony/debug": "~3.4|~4.0", - "symfony/event-dispatcher": "^4.3", - "symfony/http-foundation": "^4.1.1", - "symfony/polyfill-ctype": "~1.8", + "symfony/error-handler": "^4.4", + "symfony/event-dispatcher": "^4.4", + "symfony/http-foundation": "^4.4|^5.0", + "symfony/polyfill-ctype": "^1.8", "symfony/polyfill-php73": "^1.9" }, "conflict": { "symfony/browser-kit": "<4.3", "symfony/config": "<3.4", + "symfony/console": ">=5", "symfony/dependency-injection": "<4.3", "symfony/translation": "<4.2", - "symfony/var-dumper": "<4.1.1", "twig/twig": "<1.34|<2.4,>=2" }, "provide": { @@ -5410,34 +5481,32 @@ }, "require-dev": { "psr/cache": "~1.0", - "symfony/browser-kit": "^4.3", - "symfony/config": "~3.4|~4.0", - "symfony/console": "~3.4|~4.0", - "symfony/css-selector": "~3.4|~4.0", - "symfony/dependency-injection": "^4.3", - "symfony/dom-crawler": "~3.4|~4.0", - "symfony/expression-language": "~3.4|~4.0", - "symfony/finder": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0", - "symfony/routing": "~3.4|~4.0", - "symfony/stopwatch": "~3.4|~4.0", - "symfony/templating": "~3.4|~4.0", - "symfony/translation": "~4.2", - "symfony/translation-contracts": "^1.1", - "symfony/var-dumper": "^4.1.1", - "twig/twig": "^1.34|^2.4" + "symfony/browser-kit": "^4.3|^5.0", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/console": "^3.4|^4.0", + "symfony/css-selector": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^4.3|^5.0", + "symfony/dom-crawler": "^3.4|^4.0|^5.0", + "symfony/expression-language": "^3.4|^4.0|^5.0", + "symfony/finder": "^3.4|^4.0|^5.0", + "symfony/process": "^3.4|^4.0|^5.0", + "symfony/routing": "^3.4|^4.0|^5.0", + "symfony/stopwatch": "^3.4|^4.0|^5.0", + "symfony/templating": "^3.4|^4.0|^5.0", + "symfony/translation": "^4.2|^5.0", + "symfony/translation-contracts": "^1.1|^2", + "twig/twig": "^1.34|^2.4|^3.0" }, "suggest": { "symfony/browser-kit": "", "symfony/config": "", "symfony/console": "", - "symfony/dependency-injection": "", - "symfony/var-dumper": "" + "symfony/dependency-injection": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -5464,30 +5533,30 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2019-10-07T15:06:41+00:00" + "time": "2019-11-21T07:08:15+00:00" }, { "name": "symfony/inflector", - "version": "v4.3.5", + "version": "v5.0.0", "source": { "type": "git", "url": "https://github.com/symfony/inflector.git", - "reference": "fc488a52c79b2bbe848fa9def35f2cccb47c4798" + "reference": "aaeb5e293294070d1b061fa3d7889bac69909320" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/inflector/zipball/fc488a52c79b2bbe848fa9def35f2cccb47c4798", - "reference": "fc488a52c79b2bbe848fa9def35f2cccb47c4798", + "url": "https://api.github.com/repos/symfony/inflector/zipball/aaeb5e293294070d1b061fa3d7889bac69909320", + "reference": "aaeb5e293294070d1b061fa3d7889bac69909320", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": "^7.2.5", "symfony/polyfill-ctype": "~1.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -5522,35 +5591,38 @@ "symfony", "words" ], - "time": "2019-09-17T11:12:06+00:00" + "time": "2019-11-18T17:27:11+00:00" }, { "name": "symfony/mime", - "version": "v4.3.5", + "version": "v5.0.0", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "32f71570547b91879fdbd9cf50317d556ae86916" + "reference": "76f3c09b7382bf979af7bcd8e6f8033f1324285e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/32f71570547b91879fdbd9cf50317d556ae86916", - "reference": "32f71570547b91879fdbd9cf50317d556ae86916", + "url": "https://api.github.com/repos/symfony/mime/zipball/76f3c09b7382bf979af7bcd8e6f8033f1324285e", + "reference": "76f3c09b7382bf979af7bcd8e6f8033f1324285e", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": "^7.2.5", "symfony/polyfill-intl-idn": "^1.10", "symfony/polyfill-mbstring": "^1.0" }, + "conflict": { + "symfony/mailer": "<4.4" + }, "require-dev": { "egulias/email-validator": "^2.1.10", - "symfony/dependency-injection": "~3.4|^4.1" + "symfony/dependency-injection": "^4.4|^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -5581,7 +5653,7 @@ "mime", "mime-type" ], - "time": "2019-09-19T17:00:15+00:00" + "time": "2019-11-18T17:27:11+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5936,16 +6008,16 @@ }, { "name": "symfony/process", - "version": "v4.3.5", + "version": "v4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "50556892f3cc47d4200bfd1075314139c4c9ff4b" + "reference": "75ad33d9b6f25325ebc396d68ad86fd74bcfbb06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/50556892f3cc47d4200bfd1075314139c4c9ff4b", - "reference": "50556892f3cc47d4200bfd1075314139c4c9ff4b", + "url": "https://api.github.com/repos/symfony/process/zipball/75ad33d9b6f25325ebc396d68ad86fd74bcfbb06", + "reference": "75ad33d9b6f25325ebc396d68ad86fd74bcfbb06", "shasum": "" }, "require": { @@ -5954,7 +6026,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -5981,28 +6053,28 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2019-09-26T21:17:10+00:00" + "time": "2019-10-28T20:30:34+00:00" }, { "name": "symfony/property-access", - "version": "v4.3.5", + "version": "v4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", - "reference": "bb0c302375ffeef60c31e72a4539611b7f787565" + "reference": "4df120cbe473d850eb59f75c341915955e45f25b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/bb0c302375ffeef60c31e72a4539611b7f787565", - "reference": "bb0c302375ffeef60c31e72a4539611b7f787565", + "url": "https://api.github.com/repos/symfony/property-access/zipball/4df120cbe473d850eb59f75c341915955e45f25b", + "reference": "4df120cbe473d850eb59f75c341915955e45f25b", "shasum": "" }, "require": { "php": "^7.1.3", - "symfony/inflector": "~3.4|~4.0" + "symfony/inflector": "^3.4|^4.0|^5.0" }, "require-dev": { - "symfony/cache": "~3.4|~4.0" + "symfony/cache": "^3.4|^4.0|^5.0" }, "suggest": { "psr/cache-implementation": "To cache access methods." @@ -6010,7 +6082,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -6048,20 +6120,20 @@ "property path", "reflection" ], - "time": "2019-08-26T08:26:39+00:00" + "time": "2019-10-12T00:35:04+00:00" }, { "name": "symfony/routing", - "version": "v4.3.5", + "version": "v4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "3b174ef04fe66696524efad1e5f7a6c663d822ea" + "reference": "cf6d72cf0348775f5243b8389169a7096221ea40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/3b174ef04fe66696524efad1e5f7a6c663d822ea", - "reference": "3b174ef04fe66696524efad1e5f7a6c663d822ea", + "url": "https://api.github.com/repos/symfony/routing/zipball/cf6d72cf0348775f5243b8389169a7096221ea40", + "reference": "cf6d72cf0348775f5243b8389169a7096221ea40", "shasum": "" }, "require": { @@ -6075,11 +6147,11 @@ "require-dev": { "doctrine/annotations": "~1.2", "psr/log": "~1.0", - "symfony/config": "~4.2", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/expression-language": "~3.4|~4.0", - "symfony/http-foundation": "~3.4|~4.0", - "symfony/yaml": "~3.4|~4.0" + "symfony/config": "^4.2|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/expression-language": "^3.4|^4.0|^5.0", + "symfony/http-foundation": "^3.4|^4.0|^5.0", + "symfony/yaml": "^3.4|^4.0|^5.0" }, "suggest": { "doctrine/annotations": "For using the annotation loader", @@ -6091,7 +6163,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -6124,20 +6196,20 @@ "uri", "url" ], - "time": "2019-10-04T20:57:10+00:00" + "time": "2019-11-20T13:44:34+00:00" }, { "name": "symfony/serializer", - "version": "v4.3.5", + "version": "v4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "805eacc72d28e237ef31659344a4d72acef335ec" + "reference": "57116a962eb0c5e165009535f1e1d2e7024e78de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/805eacc72d28e237ef31659344a4d72acef335ec", - "reference": "805eacc72d28e237ef31659344a4d72acef335ec", + "url": "https://api.github.com/repos/symfony/serializer/zipball/57116a962eb0c5e165009535f1e1d2e7024e78de", + "reference": "57116a962eb0c5e165009535f1e1d2e7024e78de", "shasum": "" }, "require": { @@ -6154,15 +6226,16 @@ "require-dev": { "doctrine/annotations": "~1.0", "doctrine/cache": "~1.0", - "phpdocumentor/reflection-docblock": "^3.0|^4.0", - "symfony/cache": "~3.4|~4.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/http-foundation": "~3.4|~4.0", - "symfony/property-access": "~3.4|~4.0", - "symfony/property-info": "^3.4.13|~4.0", - "symfony/validator": "~3.4|~4.0", - "symfony/yaml": "~3.4|~4.0" + "phpdocumentor/reflection-docblock": "^3.2|^4.0", + "symfony/cache": "^3.4|^4.0|^5.0", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/error-handler": "^4.4|^5.0", + "symfony/http-foundation": "^3.4|^4.0|^5.0", + "symfony/property-access": "^3.4|^4.0|^5.0", + "symfony/property-info": "^3.4.13|~4.0|^5.0", + "symfony/validator": "^3.4|^4.0|^5.0", + "symfony/yaml": "^3.4|^4.0|^5.0" }, "suggest": { "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", @@ -6177,7 +6250,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -6204,24 +6277,24 @@ ], "description": "Symfony Serializer Component", "homepage": "https://symfony.com", - "time": "2019-10-02T15:03:35+00:00" + "time": "2019-11-13T07:39:40+00:00" }, { "name": "symfony/service-contracts", - "version": "v1.1.7", + "version": "v2.0.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "ffcde9615dc5bb4825b9f6aed07716f1f57faae0" + "reference": "9d99e1556417bf227a62e14856d630672bf10eaf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/ffcde9615dc5bb4825b9f6aed07716f1f57faae0", - "reference": "ffcde9615dc5bb4825b9f6aed07716f1f57faae0", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/9d99e1556417bf227a62e14856d630672bf10eaf", + "reference": "9d99e1556417bf227a62e14856d630672bf10eaf", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": "^7.2.9", "psr/container": "^1.0" }, "suggest": { @@ -6230,7 +6303,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -6262,30 +6335,31 @@ "interoperability", "standards" ], - "time": "2019-09-17T11:12:18+00:00" + "time": "2019-11-09T09:18:34+00:00" }, { "name": "symfony/translation", - "version": "v4.3.5", + "version": "v4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "fe6193b066c457c144333c06aaa869a2d42a167f" + "reference": "897fb68ee7933372517b551d6f08c6d4bb0b8c40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/fe6193b066c457c144333c06aaa869a2d42a167f", - "reference": "fe6193b066c457c144333c06aaa869a2d42a167f", + "url": "https://api.github.com/repos/symfony/translation/zipball/897fb68ee7933372517b551d6f08c6d4bb0b8c40", + "reference": "897fb68ee7933372517b551d6f08c6d4bb0b8c40", "shasum": "" }, "require": { "php": "^7.1.3", "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^1.1.6" + "symfony/translation-contracts": "^1.1.6|^2" }, "conflict": { "symfony/config": "<3.4", "symfony/dependency-injection": "<3.4", + "symfony/http-kernel": "<4.4", "symfony/yaml": "<3.4" }, "provide": { @@ -6293,15 +6367,14 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/console": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/finder": "~2.8|~3.0|~4.0", - "symfony/http-kernel": "~3.4|~4.0", - "symfony/intl": "~3.4|~4.0", - "symfony/service-contracts": "^1.1.2", - "symfony/var-dumper": "~3.4|~4.0", - "symfony/yaml": "~3.4|~4.0" + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/console": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/finder": "~2.8|~3.0|~4.0|^5.0", + "symfony/http-kernel": "^4.4", + "symfony/intl": "^3.4|^4.0|^5.0", + "symfony/service-contracts": "^1.1.2|^2", + "symfony/yaml": "^3.4|^4.0|^5.0" }, "suggest": { "psr/log-implementation": "To use logging capability in translator", @@ -6311,7 +6384,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -6338,24 +6411,24 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2019-09-27T14:37:39+00:00" + "time": "2019-11-12T17:18:47+00:00" }, { "name": "symfony/translation-contracts", - "version": "v1.1.7", + "version": "v2.0.0", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "364518c132c95642e530d9b2d217acbc2ccac3e6" + "reference": "8feb81e6bb1a42d6a3b1429c751d291eb6d05297" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/364518c132c95642e530d9b2d217acbc2ccac3e6", - "reference": "364518c132c95642e530d9b2d217acbc2ccac3e6", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/8feb81e6bb1a42d6a3b1429c751d291eb6d05297", + "reference": "8feb81e6bb1a42d6a3b1429c751d291eb6d05297", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^7.2.9" }, "suggest": { "symfony/translation-implementation": "" @@ -6363,7 +6436,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -6395,20 +6468,20 @@ "interoperability", "standards" ], - "time": "2019-09-17T11:12:18+00:00" + "time": "2019-11-09T09:18:34+00:00" }, { "name": "symfony/var-dumper", - "version": "v4.3.5", + "version": "v4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "bde8957fc415fdc6964f33916a3755737744ff05" + "reference": "eade2890f8b0eeb279b6cf41b50a10007294490f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/bde8957fc415fdc6964f33916a3755737744ff05", - "reference": "bde8957fc415fdc6964f33916a3755737744ff05", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/eade2890f8b0eeb279b6cf41b50a10007294490f", + "reference": "eade2890f8b0eeb279b6cf41b50a10007294490f", "shasum": "" }, "require": { @@ -6422,9 +6495,9 @@ }, "require-dev": { "ext-iconv": "*", - "symfony/console": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0", - "twig/twig": "~1.34|~2.4" + "symfony/console": "^3.4|^4.0|^5.0", + "symfony/process": "^4.4|^5.0", + "twig/twig": "^1.34|^2.4|^3.0" }, "suggest": { "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", @@ -6437,7 +6510,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -6471,20 +6544,20 @@ "debug", "dump" ], - "time": "2019-10-04T19:48:13+00:00" + "time": "2019-11-12T14:51:11+00:00" }, { "name": "symfony/yaml", - "version": "v4.3.5", + "version": "v4.4.0", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "41e16350a2a1c7383c4735aa2f9fce74cf3d1178" + "reference": "76de473358fe802578a415d5bb43c296cf09d211" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/41e16350a2a1c7383c4735aa2f9fce74cf3d1178", - "reference": "41e16350a2a1c7383c4735aa2f9fce74cf3d1178", + "url": "https://api.github.com/repos/symfony/yaml/zipball/76de473358fe802578a415d5bb43c296cf09d211", + "reference": "76de473358fe802578a415d5bb43c296cf09d211", "shasum": "" }, "require": { @@ -6495,7 +6568,7 @@ "symfony/console": "<3.4" }, "require-dev": { - "symfony/console": "~3.4|~4.0" + "symfony/console": "^3.4|^4.0|^5.0" }, "suggest": { "symfony/console": "For validating YAML files using the lint command" @@ -6503,7 +6576,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "4.4-dev" } }, "autoload": { @@ -6530,7 +6603,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2019-09-11T15:41:19+00:00" + "time": "2019-11-12T14:51:11+00:00" }, { "name": "theiconic/php-ga-measurement-protocol", @@ -7246,16 +7319,16 @@ }, { "name": "doctrine/instantiator", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "a2c590166b2133a4633738648b6b064edae0814a" + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", - "reference": "a2c590166b2133a4633738648b6b064edae0814a", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", "shasum": "" }, "require": { @@ -7298,20 +7371,20 @@ "constructor", "instantiate" ], - "time": "2019-03-17T17:37:11+00:00" + "time": "2019-10-21T16:45:58+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.15.3", + "version": "v2.16.1", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "705490b0f282f21017d73561e9498d2b622ee34c" + "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/705490b0f282f21017d73561e9498d2b622ee34c", - "reference": "705490b0f282f21017d73561e9498d2b622ee34c", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/c8afb599858876e95e8ebfcd97812d383fa23f02", + "reference": "c8afb599858876e95e8ebfcd97812d383fa23f02", "shasum": "" }, "require": { @@ -7322,15 +7395,15 @@ "ext-tokenizer": "*", "php": "^5.6 || ^7.0", "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.4.17 || ^4.1.6", - "symfony/event-dispatcher": "^3.0 || ^4.0", - "symfony/filesystem": "^3.0 || ^4.0", - "symfony/finder": "^3.0 || ^4.0", - "symfony/options-resolver": "^3.0 || ^4.0", + "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", + "symfony/event-dispatcher": "^3.0 || ^4.0 || ^5.0", + "symfony/filesystem": "^3.0 || ^4.0 || ^5.0", + "symfony/finder": "^3.0 || ^4.0 || ^5.0", + "symfony/options-resolver": "^3.0 || ^4.0 || ^5.0", "symfony/polyfill-php70": "^1.0", "symfony/polyfill-php72": "^1.4", - "symfony/process": "^3.0 || ^4.0", - "symfony/stopwatch": "^3.0 || ^4.0" + "symfony/process": "^3.0 || ^4.0 || ^5.0", + "symfony/stopwatch": "^3.0 || ^4.0 || ^5.0" }, "require-dev": { "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", @@ -7343,8 +7416,8 @@ "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1", "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.1", "phpunitgoodpractices/traits": "^1.8", - "symfony/phpunit-bridge": "^4.3", - "symfony/yaml": "^3.0 || ^4.0" + "symfony/phpunit-bridge": "^4.3 || ^5.0", + "symfony/yaml": "^3.0 || ^4.0 || ^5.0" }, "suggest": { "ext-mbstring": "For handling non-UTF8 characters in cache signature.", @@ -7387,7 +7460,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2019-08-31T12:51:54+00:00" + "time": "2019-11-25T22:10:32+00:00" }, { "name": "fzaninotto/faker", @@ -8187,16 +8260,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "7.0.8", + "version": "7.0.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "aa0d179a13284c7420fc281fc32750e6cc7c9e2f" + "reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa0d179a13284c7420fc281fc32750e6cc7c9e2f", - "reference": "aa0d179a13284c7420fc281fc32750e6cc7c9e2f", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f1884187926fbb755a9aaf0b3836ad3165b478bf", + "reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf", "shasum": "" }, "require": { @@ -8246,7 +8319,7 @@ "testing", "xunit" ], - "time": "2019-09-17T06:24:36+00:00" + "time": "2019-11-20T13:55:58+00:00" }, { "name": "phpunit/php-file-iterator", @@ -8439,16 +8512,16 @@ }, { "name": "phpunit/phpunit", - "version": "8.4.2", + "version": "8.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a142a7e66c0ea7b5b6c04ee27f08d10d1137cd9b" + "reference": "67f9e35bffc0dd52d55d565ddbe4230454fd6a4e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a142a7e66c0ea7b5b6c04ee27f08d10d1137cd9b", - "reference": "a142a7e66c0ea7b5b6c04ee27f08d10d1137cd9b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/67f9e35bffc0dd52d55d565ddbe4230454fd6a4e", + "reference": "67f9e35bffc0dd52d55d565ddbe4230454fd6a4e", "shasum": "" }, "require": { @@ -8518,7 +8591,7 @@ "testing", "xunit" ], - "time": "2019-10-28T10:39:51+00:00" + "time": "2019-11-06T09:42:23+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -8687,16 +8760,16 @@ }, { "name": "sebastian/environment", - "version": "4.2.2", + "version": "4.2.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404" + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/f2a2c8e1c97c11ace607a7a667d73d47c19fe404", - "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", "shasum": "" }, "require": { @@ -8736,7 +8809,7 @@ "environment", "hhvm" ], - "time": "2019-05-05T09:05:15+00:00" + "time": "2019-11-20T08:46:58+00:00" }, { "name": "sebastian/exporter", @@ -9188,25 +9261,25 @@ }, { "name": "symfony/options-resolver", - "version": "v4.3.5", + "version": "v5.0.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "81c2e120522a42f623233968244baebd6b36cb6a" + "reference": "1ad3d0ffc00cc1990e5c9c7bb6b81578ec3f5f68" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/81c2e120522a42f623233968244baebd6b36cb6a", - "reference": "81c2e120522a42f623233968244baebd6b36cb6a", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/1ad3d0ffc00cc1990e5c9c7bb6b81578ec3f5f68", + "reference": "1ad3d0ffc00cc1990e5c9c7bb6b81578ec3f5f68", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^7.2.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -9238,7 +9311,7 @@ "configuration", "options" ], - "time": "2019-08-08T09:29:19+00:00" + "time": "2019-11-18T17:27:11+00:00" }, { "name": "symfony/polyfill-php70", @@ -9301,26 +9374,26 @@ }, { "name": "symfony/stopwatch", - "version": "v4.3.5", + "version": "v5.0.0", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "1e4ff456bd625be5032fac9be4294e60442e9b71" + "reference": "d410282956706e0b08681a5527447a8e6b6f421e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/1e4ff456bd625be5032fac9be4294e60442e9b71", - "reference": "1e4ff456bd625be5032fac9be4294e60442e9b71", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/d410282956706e0b08681a5527447a8e6b6f421e", + "reference": "d410282956706e0b08681a5527447a8e6b6f421e", "shasum": "" }, "require": { - "php": "^7.1.3", - "symfony/service-contracts": "^1.0" + "php": "^7.2.5", + "symfony/service-contracts": "^1.0|^2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.3-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -9347,7 +9420,7 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2019-08-07T11:52:19+00:00" + "time": "2019-11-18T17:27:11+00:00" }, { "name": "theseer/tokenizer", @@ -9391,31 +9464,29 @@ }, { "name": "webmozart/assert", - "version": "1.5.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4" + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/88e6d84706d09a236046d686bbea96f07b3a34f4", - "reference": "88e6d84706d09a236046d686bbea96f07b3a34f4", + "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", "shasum": "" }, "require": { "php": "^5.3.3 || ^7.0", "symfony/polyfill-ctype": "^1.8" }, + "conflict": { + "vimeo/psalm": "<3.6.0" + }, "require-dev": { "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -9437,7 +9508,7 @@ "check", "validate" ], - "time": "2019-08-24T08:43:50+00:00" + "time": "2019-11-24T13:36:37+00:00" } ], "aliases": [], diff --git a/config/modules.php b/config/modules.php index 184ece94b..2ec7508de 100644 --- a/config/modules.php +++ b/config/modules.php @@ -1,5 +1,7 @@ 'Modules', 'stubs' => [ @@ -133,4 +135,14 @@ 'register' => [ 'translations' => true, ], + + 'activator' => 'file', + 'activators' => [ + 'file' => [ + 'class' => FileActivator::class, + 'statuses-file' => config_path('modules_statuses.json'), + 'cache-key' => 'activator.installed', + 'cache-lifetime' => 604800, + ], + ], ]; diff --git a/config/modules_statuses.json b/config/modules_statuses.json new file mode 100644 index 000000000..6aba04221 --- /dev/null +++ b/config/modules_statuses.json @@ -0,0 +1,7 @@ +{ + "Awards": true, + "Installer": true, + "Sample": true, + "VMSAcars": true, + "Vacentral": true +} \ No newline at end of file diff --git a/config/queue.php b/config/queue.php index e4026e0d5..e6031055d 100755 --- a/config/queue.php +++ b/config/queue.php @@ -14,7 +14,7 @@ | */ - 'default' => env('QUEUE_DRIVER', 'sync'), + 'default' => env('QUEUE_DRIVER', 'database'), /* |-------------------------------------------------------------------------- diff --git a/config/repository.php b/config/repository.php index 9a90078ef..d4663ba7f 100644 --- a/config/repository.php +++ b/config/repository.php @@ -2,7 +2,7 @@ return [ 'pagination' => [ - 'limit' => 50, + 'limit' => 20, ], /* diff --git a/intellij_style.xml b/intellij_style.xml index 903cf02a8..9c0b52567 100644 --- a/intellij_style.xml +++ b/intellij_style.xml @@ -1,16 +1,15 @@ - - + + + + +