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

Passing variables #29

Closed
stefan25w opened this issue Jun 16, 2014 · 2 comments
Closed

Passing variables #29

stefan25w opened this issue Jun 16, 2014 · 2 comments
Assignees
Labels

Comments

@stefan25w
Copy link

Is it possible to pass a variable to Cron::add function?

$variable = 'testing';

Cron::add('example', '* * * * *', function($variable) {
Log::info($variable);
return null;
}
@liebig liebig self-assigned this Jun 16, 2014
@liebig
Copy link
Owner

liebig commented Jun 16, 2014

Yes it is. Please use the keyworkd use to pass a variable to the function.

$variable = 'testing';
Cron::add('example', '* * * * *', function() use ($variable) {
     Log::info($variable);
     return null;
});

@stefan25w
Copy link
Author

Thanks. That did the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants