Skip to content

Extending Modules

Thorazine edited this page Aug 11, 2017 · 3 revisions

Models can be extended from routes/cms file. This file gets included in the original routes file and thus has all the proper group policies already set for you to use without config.

In your routes/cms there is an example of how to add a route. But be sure to look at the routes file in the package, copy that and replace the namespace. You will also have to match the dependencies the original controller has and set the new Controller as the new child. An extended controller might look something like this:

<?php

namespace App\Http\Controllers\Cms;

use Thorazine\Hack\Http\Controllers\Cms\CarouselController as BaseCarouselController;
use Thorazine\Hack\Models\Carousel;

class CarouselController extends BaseCarouselController
{

    public function __construct(Carousel $model)
    {
        parent::__construct($model); 
        $this->child = $this;
    }
}