master

laravel/framework

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

ControllerDispatcher.php

TLDR

This file defines an interface named ControllerDispatcher in the namespace Illuminate\Routing\Contracts. The interface provides two methods: dispatch and getMiddleware for dispatching requests to controllers and getting middleware for controller instances, respectively.

Methods

dispatch

Dispatches a request to a given controller and method.

getMiddleware

Gets the middleware for the controller instance.

The above methods are part of the ControllerDispatcher interface.

<?php

namespace Illuminate\Routing\Contracts;

use Illuminate\Routing\Route;

interface ControllerDispatcher
{
    /**
     * Dispatch a request to a given controller and method.
     *
     * @param  \Illuminate\Routing\Route  $route
     * @param  mixed  $controller
     * @param  string  $method
     * @return mixed
     */
    public function dispatch(Route $route, $controller, $method);

    /**
     * Get the middleware for the controller instance.
     *
     * @param  \Illuminate\Routing\Controller  $controller
     * @param  string  $method
     * @return array
     */
    public function getMiddleware($controller, $method);
}