src/Label305/AujaLaravel/Routing/AujaRouter.php
public function resource($modelName, $controller) {
        if (php_sapi_name() == 'cli') {
            /* Don't run when we're running artisan commands. */
            return;
        }

        if (!class_exists($controller)) {
            throw new ExpectedAujaControllerException($controller . ' does not exist.');
        }

        if (!is_subclass_of($controller, 'Label305\AujaLaravel\Controllers\Interfaces\AujaControllerInterface')) {
            throw new ExpectedAujaControllerException(
                $controller . ' does not implement Label305\AujaLaravel\Controllers\Interfaces\AujaControllerInterface'
            );
        }

        /* Default routes */
        $this->registerIndex($modelName, $controller);
        $this->registerMenu($modelName, $controller);
        $this->registerShowMenu($modelName, $controller);
        $this->registerCreate($modelName, $controller);
        $this->registerStore($modelName, $controller);
        $this->registerShow($modelName, $controller);
        $this->registerEdit($modelName, $controller);
        $this->registerUpdate($modelName, $controller);
        $this->registerDelete($modelName, $controller);

        /* Associated routes */
        $model = $this->auja->getModel(ucfirst(str_singular(camel_case($modelName)))); // TODO: prettify
        $relations = $this->auja->getRelationsForModel($model);
        foreach ($relations as $relation) {
            $otherModelName = $relation->getRight()->getName();
            if ($relation->getType() == Relation::BELONGS_TO) {
                $this->registerBelongsToAssociationMenu($modelName, $otherModelName, $controller);
            } else {
                $this->registerAssociation($modelName, $otherModelName, $controller);
                $this->registerAssociationMenu($modelName, $otherModelName, $controller);
                $this->registerCreateAssociation($modelName, $otherModelName, $controller);
            }
        }
    }
public function resource($modelName, $controller) {
        if (php_sapi_name() == 'cli') {
            /* Don't run when we're running artisan commands. */
            return;
        }

        if (!class_exists($controller)) {
            throw new ExpectedAujaControllerException($controller . ' does not exist.');
        }

        if (!is_subclass_of($controller, 'Label305\AujaLaravel\Controllers\Interfaces\AujaControllerInterface')) {
            throw new ExpectedAujaControllerException(
                $controller . ' does not implement Label305\AujaLaravel\Controllers\Interfaces\AujaControllerInterface'
            );
        }

        /* Default routes */
        $this->registerIndex($modelName, $controller);
        $this->registerMenu($modelName, $controller);
        $this->registerShowMenu($modelName, $controller);
        $this->registerCreate($modelName, $controller);
        $this->registerStore($modelName, $controller);
        $this->registerShow($modelName, $controller);
        $this->registerEdit($modelName, $controller);
        $this->registerUpdate($modelName, $controller);
        $this->registerDelete($modelName, $controller);

        /* Associated routes */
        $model = $this->auja->getModel(ucfirst(str_singular(camel_case($modelName)))); // TODO: prettify
        $relations = $this->auja->getRelationsForModel($model);
        foreach ($relations as $relation) {
            $otherModelName = $relation->getRight()->getName();
            if ($relation->getType() == Relation::BELONGS_TO) {
                $this->registerBelongsToAssociationMenu($modelName, $otherModelName, $controller);
            } else {
                $this->registerAssociation($modelName, $otherModelName, $controller);
                $this->registerAssociationMenu($modelName, $otherModelName, $controller);
                $this->registerCreateAssociation($modelName, $otherModelName, $controller);
            }
        }
    }
Route an Auja configuration for a model to a controller.

@param String $modelName  The name of the model.
@param String $controller The name of the Controller.