Is there a way to list routes for controllers in Odoo 10. Other MVC frameworks can do this, for example this can be done in Symfony: Symfony2: get list of all routes of a controller
Related
I've started with Codeigniter 4 today. I have an app that I've built with Codeigniter 3 and now I want to upgrade it to CI4. The first thing is to upgrade routes. I have a simple but GREAT solution by enabling users to define their own routes with a simple page, like this:
And it was super easy, just needed to load and update Routes.php file - arrays of routes.
Now, as I am looking at app/config/Routes.php in CI4 I see it is not a simple array but there is much more to it. So, my question is what would be the simplest way to enable users to define their own routes with a webpage?
I am new to Laravel and by reading a bit its documentation, it seems that for each new page or url I need to define a route in the web.php file. Please correct me if I am wrong.
So, my question is... Is there a way to create a pattern as in YII framework or .NET framework to manage all routes (or most of them) at once by using something like:
{controller}/{action}/{id}
Well not exactly like Yii or .net but you can declare multiple routes in one line using Resource Controllers.
Laravel resource routing assigns the typical "CRUD" routes to a controller with a single line of code. For example, you may wish to create a controller that handles all HTTP requests for "photos" stored by your application.
You can do so by Route::resource('photos', 'PhotoController');
Read more here
I have the following folder structure
Modules
--controllers
--User
--Product
How can I call the product controller from user controller from one particular function?
When I run this url http://[::1]/stagingweb/index.php/user/product I get the error 'The page you requested was not found'.
it looks like you have a problem to understand the concept of hmvc here
HMVC stands for Hierarchical model–view–controller, which means in Wiredesignz HMVC there is an additional variation called modules added to the classical MVC pattern used by Codeigniter.
in your case if you have users and products, its probably the best to create 2 modules (users and products).
So your folder structure would look like
modules
- users
- controllers
User.php
- models
- views
- products
- controllers
Product.php
- models
- views
in Wiredesignz HMVC Integration there is a class MX_Controller, so every module controller has to extend from it.
an example
class Product extends MX_Controller{}
And if you want to call another modules controller within your specific controller you simply have to call
$return = modules::run('products/product/your_function');
Though in most cases it's probably a cleaner solution to just call the models from the other modules instead of executing a controllers function...
The entire process is very well documented here
Rails generates a folder of view template scaffolds when you run the cli command rails g controller User.
It will have view template scaffolding for create_user.html.erb, update_user.html.erb, list_user.html.erv....etc etc.
Is there anyway to have that same functionality in Laravel whether via a library, some included function, or a custom generator(or some other way)?
I'm using Laravel 5.4 if that makes a difference.
Since you're looking to generate views, I assume you're talking about a CRUD admin panel rather than an API. I highly recommend Laravel CRUD.
https://github.com/Laravel-Backpack/CRUD
This will allow you to create a model, controller, all routes, views etc with the command php artisan backpack:crud Model. It's super easy to use, but you'd want to probably start your project fresh - it assumes you're using it for the whole admin section, not just the views.
I am trying to implement ASP.net web API versioning using URL(namespace) techniques.
I have existing controller say Roles controller. I am able to access it via route .../ API/roles.
Now I have added one more controller with same name Roles but in different folder say V1.
I added route for this new controller and I am able to access it via .../API/V1/roles.
But now when I am trying to access my old route I.e. .../API/roles. I am getting error as multiple controller found. One controller in folder V1 and another in folder controllers.
Can anyone help me in figuring out this issue. How to fallback the existing routes.
If I add another folder v2 and try to access roles controller over there its working fine.
But for existing controller which is placed directly in Controllers folder its not working.
Any help is appreciated.
Thanks.