laravel / ideas

Issues board used for Laravel internals discussions.
938 stars 28 forks source link

[NFR] Add halt option to dispatch method of Dispatchable trait #2560

Closed erisrayanesh closed 3 years ago

erisrayanesh commented 3 years ago

Hi. The dispatch method of Illuminate\Foundation\Events\Dispatchable trait doesn't support the halt option in dispatch method of Illuminate\Events\Dispatcher.

The trait method gathers all the arguments for the event class and should be changed to something like:

public static function dispatch($halt, ...$arguments)
{
    return event(new static($arguments), [], $halt);
}
themsaid commented 3 years ago

Feel free to open a PR