classes/Routing/Wildcard.php
public function detectAndExecute()
    {
        // Get the controller
        if (!($controller = $this->detectController())) {
            return false;
        }

        // Get the action
        $action = $this->detectAction();
        if (!$action || !method_exists($controller, $action)) {
            return false;
        }

        // Get the id
        $id = $this->detectId();

        // Tell other classes what was found
        $event = Event::fire('wildcard.detection', [
            $controller, $action, $id
        ]);

        // Instantiate controller
        $controller = new $controller();
        if ($parent = $this->detectParent()) {
            list($parent_slug, $parent_id) = $parent;
            $parent_model = 'App\\'.Str::singular(Str::studly($parent_slug));
            $controller->parent($parent_model::findOrFail($parent_id));
        }

        // Execute the request
        $params = $id ? [$id] : [];
        return $controller->callAction($action, $params);
    }
public function detectAndExecute()
    {
        // Get the controller
        if (!($controller = $this->detectController())) {
            return false;
        }

        // Get the action
        $action = $this->detectAction();
        if (!$action || !method_exists($controller, $action)) {
            return false;
        }

        // Get the id
        $id = $this->detectId();

        // Tell other classes what was found
        $event = Event::fire('wildcard.detection', [
            $controller, $action, $id
        ]);

        // Instantiate controller
        $controller = new $controller();
        if ($parent = $this->detectParent()) {
            list($parent_slug, $parent_id) = $parent;
            $parent_model = 'App\\'.Str::singular(Str::studly($parent_slug));
            $controller->parent($parent_model::findOrFail($parent_id));
        }

        // Execute the request
        $params = $id ? [$id] : [];
        return $controller->callAction($action, $params);
    }
public function detectAndExecute ( ) { // Get the controller if ( ! ( $ controller = $ this -> detectController ( ) ) ) { return false ; } // Get the action $ action = $ this -> detectAction ( ) ; if ( ! $ action || ! method_exists ( $ controller , $ action ) ) { return false ; } // Get the id $ id = $ this -> detectId ( ) ; // Tell other classes what was found $ event = Event :: fire ( 'wildcard.detection' , [ $ controller , $ action , $ id ] ) ; // Instantiate controller $ controller = new $ controller ( ) ; if ( $ parent = $ this -> detectParent ( ) ) { list ( $ parent_slug , $ parent_id ) = $ parent ; $ parent_model = 'App\\' . Str :: singular ( Str :: studly ( $ parent_slug ) ) ; $ controller -> parent ( $ parent_model :: findOrFail ( $ parent_id ) ) ; } // Execute the request $ params = $ id ? [ $ id ] : [ ] ; return $ controller -> callAction ( $ action , $ params ) ; }
Detect the controller for a given route and then execute the action
that is specified in the route.
Detect the controller for a given route and then execute the action that is specified in the route .