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

[8.x] Allow for named arguments via dispatchable trait #38066

Merged
merged 1 commit into from
Jul 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/Illuminate/Foundation/Bus/Dispatchable.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ trait Dispatchable
*
* @return \Illuminate\Foundation\Bus\PendingDispatch
*/
public static function dispatch()
public static function dispatch(...$arguments)
{
return new PendingDispatch(new static(...func_get_args()));
return new PendingDispatch(new static(...$arguments));
}

/**
Expand Down Expand Up @@ -52,9 +52,9 @@ public static function dispatchUnless($boolean, ...$arguments)
*
* @return mixed
*/
public static function dispatchSync()
public static function dispatchSync(...$arguments)
{
return app(Dispatcher::class)->dispatchSync(new static(...func_get_args()));
return app(Dispatcher::class)->dispatchSync(new static(...$arguments));
}

/**
Expand All @@ -64,19 +64,19 @@ public static function dispatchSync()
*
* @deprecated Will be removed in a future Laravel version.
*/
public static function dispatchNow()
public static function dispatchNow(...$arguments)
{
return app(Dispatcher::class)->dispatchNow(new static(...func_get_args()));
return app(Dispatcher::class)->dispatchNow(new static(...$arguments));
}

/**
* Dispatch a command to its appropriate handler after the current process.
*
* @return mixed
*/
public static function dispatchAfterResponse()
public static function dispatchAfterResponse(...$arguments)
{
return app(Dispatcher::class)->dispatchAfterResponse(new static(...func_get_args()));
return app(Dispatcher::class)->dispatchAfterResponse(new static(...$arguments));
}

/**
Expand Down