AsgardCms / Platform

A modular multilingual CMS built with Laravel 5.
https://asgardcms.com/
MIT License
781 stars 241 forks source link

Able to Override Views, Routes of all the modules #234

Closed pralhadstha closed 7 years ago

pralhadstha commented 8 years ago

Summary of issue

For Now we can only override the views of dashboard and user modules. It would be great if we could override all the modules including the Themes for views and routes.

System Details

We can add

        $this->publishes([
            __DIR__ . '/../Resources/views' => base_path('resources/views/asgard/user'),
        ]);
        $this->loadViewsFrom(base_path('resources/views/asgard/user'), 'user');
        $this->loadViewsFrom(__DIR__ . '/../Resources/views', 'user');

this code in all the modules but it is not a better option. I have tried to add dynamically as suggested by @armababy but no success till now. Does anyone have any success on overriding views and routes?

armababy commented 8 years ago

I'll soon PR the view override thingy of all AsgardCMS core modules. About routes i have no idea never looked at that.

nWidart commented 8 years ago

Views will be handled by @armababy 's solution. Routes however is more tricky, but you can do it by leveraging how laravel loads its routes: first in first out. You can create the same route but it needs to load before.

armababy commented 7 years ago

View override has been merged into 2.0 branch as of b9d45de commit, please try it out and see if it does what you expect.