Skip to content

Commit

Permalink
Add dispatchNow to Dispatchable Trait.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrseliga committed Mar 6, 2018
1 parent 49770ec commit ab526b7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Illuminate/Foundation/Bus/Dispatchable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Illuminate\Foundation\Bus;

use Illuminate\Contracts\Bus\Dispatcher;

trait Dispatchable
{
/**
Expand All @@ -14,6 +16,16 @@ public static function dispatch()
return new PendingDispatch(new static(...func_get_args()));
}

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

/**
* Set the jobs that should run if this job is successful.
*
Expand Down

0 comments on commit ab526b7

Please sign in to comment.