Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] Add afterStore hooks #894

Merged
merged 4 commits into from
May 11, 2020
Merged

[3.x] Add afterStore hooks #894

merged 4 commits into from
May 11, 2020

Conversation

barryvdh
Copy link
Contributor

Add a hook for after the actual recording. This could be used for notifications etc, sending the actual Telescope URL in the mail/Slack message

Telescope::afterStore(function(Telescope $telescope, $batchId) {

    foreach ($telescope::$entriesQueue as $entry) {
        if ($entry instanceof IncomingExceptionEntry) {
           dispatch(new TelescopeExceptionNotification($entry));
        }
    }
});

@driesvints driesvints changed the title Add afterStore hooks [3.x] Add afterStore hooks May 11, 2020
@taylorotwell
Copy link
Member

Should we send the entries to this callback? It feels odd to have to dig into a static property of Telescope to access them.

@barryvdh
Copy link
Contributor Author

Yeah sure, so entries first and then batchId? Not sure if the instance is needed, but that was more inline with the afterRecord one. Will change it

@taylorotwell
Copy link
Member

Yeah I think that makes sense.

@barryvdh
Copy link
Contributor Author

I've updated the signature and also moved the store/filter methods inside the 'without recording' block, because otherwise it would generate Entries for the store/updates (which were then never flushed anyway).

@taylorotwell taylorotwell merged commit 96eca34 into laravel:3.x May 11, 2020
@barryvdh barryvdh deleted the patch-5 branch May 11, 2020 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants