Skip to content

Use dispatch method instead of fire method. #346

Description

@xharpenParksuhyeon

https://laravel.com/docs/5.8/upgrade#events

The fire Method
Likelihood Of Impact: Low

The fire method (which was deprecated in Laravel 5.4) of the Illuminate\Events\Dispatcher class [has been removed](https://github.com/laravel/framework/pull/26392). You should use the dispatch method instead.

Event::fire Method가 삭제되고 Event::dispatch 메소드를 사용되도록 라라벨 코어가 수정되었습니다.

라라벨 5.5 버전에도 Event::dispatch 메소드는 지원되고 있는 걸 확인했습니다.
그래서 fire 메소드를 사용하고 있는 부분을 dispatch 로 변경해 해결했습니다.

아래 코드는 라라벨 5.5 쪽에 작성되어 있는 코드 중 일부 입니다.
https://laravel.com/api/5.5/Illuminate/Events/Dispatcher.html

   /**
     * Flush a set of pushed events.
     *
     * @param  string  $event
     * @return void
     */
    public function flush($event)
    {
        $this->dispatch($event.'_pushed');
    }

    /**
     * Register an event subscriber with the dispatcher.
     *
     * @param  object|string  $subscriber
     * @return void
     */
    public function subscribe($subscriber)
    {
        $subscriber = $this->resolveSubscriber($subscriber);

        $subscriber->subscribe($this);
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions