Skip to content

Commit

Permalink
Merge pull request #28 from envor/main
Browse files Browse the repository at this point in the history
allow fallback to 'datastore_context' key in container
  • Loading branch information
inmanturbo authored Jun 20, 2024
2 parents e06fb19 + c7e7f70 commit 2b90463
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

All notable changes to `one-app` will be documented in this file.

## v1.0.21 - 2024-06-20

### What's Changed

* Fix installation command by @imanghafoori1 in https://github.com/envor/one-app/pull/26
* Don't check for team until the payload is being created by @inmanturbo in https://github.com/envor/one-app/pull/27

### New Contributors

* @imanghafoori1 made their first contribution in https://github.com/envor/one-app/pull/26

**Full Changelog**: https://github.com/envor/one-app/compare/v1.0.20...v1.0.21

## v1.0.20 - 2024-06-04

### What's Changed
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"require": {
"php": "^8.2",
"envor/laravel-datastore": "^1.2",
"envor/laravel-datastore": "^1.2.14",
"envor/laravel-schema-macros": "^1.1",
"envor/platform": "^1.6",
"headerx/laravel-jetstream-passport": "^1.0",
Expand Down
2 changes: 2 additions & 0 deletions stubs/one-app/app/Models/Team.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ protected function casts(): array
protected function configured(): void
{
app()->forgetInstance('team');
app()->forgetInstance('datastore_context');
app()->instance('datastore_context', $this);
app()->instance('team', $this);
}
}
14 changes: 10 additions & 4 deletions stubs/one-app/app/Providers/DomainServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,21 @@ public function configureRequests()
public function configureQueue()
{
$this->app['queue']->createPayloadUsing(function () {
return isset($this->app['team']) ? [
'team_uuid' => $this->app['team']->uuid,
] : [];
$datastoreContext = $this->app[HasDatastoreContext::class]->datastoreContext();

if (! $datastoreContext) {
return [];
}

return [
'team_uuid' => $datastoreContext->uuid,
];
});

$this->app['events']->listen(JobProcessing::class, function ($event) {
if (isset($event->job->payload()['team_uuid'])) {
$team = Team::where('uuid', $event->job->payload()['team_uuid'])->first();
$team->configure()->use();
$team?->configure()?->use();
}
});
}
Expand Down

0 comments on commit 2b90463

Please sign in to comment.