M
M
Max2020-06-08 17:33:49
Laravel
Max, 2020-06-08 17:33:49

How to organize view directories?

Hello, there are a bunch of view directories in the project:

return view('account.admin.products.index')->with('products', $products);

how is it better to organize this, otherwise the account.admin.products.index construction is not very good in my opinion (

I think it is necessary to somehow predefine the directory (account / role), somewhere earlier, so that on the basis of the role it is determined which directory to use for the view.

for example:
you need to display the list of products - account.admin.products.index

somehow needs to be automatically pulled up based on the role of the account.admin or account.user catalog
and then in the controller we simply write products.index

How is it better to implement it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
jazzus, 2020-06-08
@jazzus

How to structure folders in Laravel is not written. They do what they want. In examples, they usually start with a resource in the singular, and I also like this option better.

user.index.base
user.index.admin
user.index.guest

Where base is the template for admin guest if they differ only in parts.

Y
Yuri Lobanov, 2014-07-05
@Andreii787

Google horizontal menu horizontal submenu css
Good examples
themedemos.dottoro.com/features/menu/horizontal-submenu
Or
codepen.io/iiil/pen/yorpE

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question