Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How To Call View in Controller #36

Closed
AleksandarVucenic opened this issue Feb 15, 2015 · 2 comments
Closed

How To Call View in Controller #36

AleksandarVucenic opened this issue Feb 15, 2015 · 2 comments
Labels

Comments

@AleksandarVucenic
Copy link

Hi, I just start using this package and its cool. What I didnt figure out is how to call View in Controller I have folder structure App\Components\System on example and how to call view in controller and is it possible to view layout in Module extend a main laravel view layout master on example and how to do it I dont have any ideas more.

@illuminate3
Copy link

My structure is:
www /app/Modules/ModuleName/

I use in my Controller located at /app/Modules/ModuleName/Http/Controllers/UsersController

        return View('ModuleName::users.index');

In my views I just call:

@extends('app')

They are located at:
/app/Modules/ModuleName/Resources/Views/Users/index.blade

My default view is located in the normal laravel location:
/app/Resources/Views/app.blade
Which is nothing different than normal.

I hope this helps!

@TerrePorter
Copy link

Look in your app/Modules/ModuleName/Providers/ModuleNameServiceProvider.php

Should have a function called registerNamespaces, that is where the namespace is registered

protected function registerNamespaces()
    {
        Lang::addNamespace('AdminModule', __DIR__.'/../Resources/Lang/');

        View::addNamespace('AdminModule', __DIR__.'/../Resources/Views/');
    }

Then as @illuminate3 said you can access the views using the like :

return View('AdminModule::users.index');

Provided the file exists at the path referenced in the above function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants