master

laravel/framework

Last updated at: 29/12/2023 09:22

DispatchesJobs.php

TLDR

This file provides a trait called DispatchesJobs that contains two methods for dispatching jobs to their appropriate handlers.

Methods

dispatch

Dispatches a job to its appropriate handler.

dispatchSync

Dispatches a job to its appropriate handler in the current process. Queueable jobs will be dispatched to the "sync" queue.

<?php

namespace Illuminate\Foundation\Bus;

trait DispatchesJobs
{
    /**
     * Dispatch a job to its appropriate handler.
     *
     * @param  mixed  $job
     * @return mixed
     */
    protected function dispatch($job)
    {
        return dispatch($job);
    }

    /**
     * Dispatch a job to its appropriate handler in the current process.
     *
     * Queueable jobs will be dispatched to the "sync" queue.
     *
     * @param  mixed  $job
     * @return mixed
     */
    public function dispatchSync($job)
    {
        return dispatch_sync($job);
    }
}