Skip to content

Commit

Permalink
Listen to more Octane events
Browse files Browse the repository at this point in the history
  • Loading branch information
stayallive committed Dec 27, 2023
1 parent 13b557d commit fdb7bc8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

use Laravel\Passport\TokenRepository;
use Laravel\Passport\ClientRepository;
use Laravel\Octane\Events\TaskTerminated;
use Laravel\Octane\Contracts\OperationTerminated;

class OctaneTaskTerminatedListener
class OctaneOperationTerminatedListener
{
public function handle(TaskTerminated $event): void
public function handle(OperationTerminated $event): void
{
$event->app->forgetInstance(TokenRepository::class);
$event->app->forgetInstance(ClientRepository::class);
Expand Down
8 changes: 7 additions & 1 deletion src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@
use Laravel\Passport\TokenRepository;
use Laravel\Passport\ClientRepository;
use Laravel\Octane\Events\TaskTerminated;
use Laravel\Octane\Events\TickTerminated;
use Laravel\Octane\Events\RequestTerminated;
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;

class ServiceProvider extends LaravelServiceProvider
{
public function boot(Dispatcher $events): void
{
$events->listen(TaskTerminated::class, OctaneTaskTerminatedListener::class);
$events->listen([
TickTerminated::class,
TaskTerminated::class,
RequestTerminated::class,
], OctaneOperationTerminatedListener::class);
}

public function register(): void
Expand Down

0 comments on commit fdb7bc8

Please sign in to comment.