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

Return callable output on Telescope::withoutRecording #1317

Merged
merged 1 commit into from
Mar 9, 2023

Conversation

adamczykpiotr
Copy link
Contributor

This PR allows method Telescope::withoutRecording to return output of the passed callable method thus allowing to make cleaner code & more in line with what is already used for database transactions in Eloquent.

I came accross this when trying to disable telescope logging on one particular command.

Before:

Telescope::stopRecording();

if(/* Some condition */)
    Telescope::startRecording();
    return self::SUCCESS;
}

Telescope::startRecording();
return self::FAILURE;

After:

return Telescope::withoutRecording(function() {
    if(/* Some condition */)
        return self::SUCCESS;
    }
    
    return self::FAILURE;
});

@taylorotwell taylorotwell merged commit d2b194b into laravel:4.x Mar 9, 2023
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.

3 participants