-
Notifications
You must be signed in to change notification settings - Fork 32
maintainability #11
Comments
Hello! The only reason is that this is my first experience with Laravel and I've just started adding contents to routes.php, but I've always kept in mind that I have to split the structure in multiple controllers.... sooner or later! So if you want to do it, that would be great! |
Alright. I'll start next weekend :) |
@xTurinx any news? how is it going? |
mhm... project is alive 👍 |
@avengerweb may you help with this? |
Oh sorry guys I forgot you :/ @avengerweb are you doing this now? If yes I would continue https://github.com/xTurinx/TC-PHP-Framework ^^ Otherwise I would start tomorrow |
@avengerweb I've seen your commit 9056188 In general your work is good. In my opinion the restructuring of the API will be a lot of work but in the end it will be worth it. If you want I will help you with this. But if we do this together we will have to discuss how to realize it. At first we need consistent routenames, namespace, classnames and methodnames. This is the most important part. In the example I've commited ( xTurinx@c66b38d ) I've defined two major methods:
With these methods we can provide search functionality and the possibility to get a specific entity. Our first step on implementing the new structure could be to create for each entity a controller class which contains the methods find and get (maybe some others). Then we just copy the code of the anonymous functions, written in the routes.php, into these controller methods. Just let me know if you want to do this with me together. |
@xTurinx, isn`t laravel style. In ur structure u have 100500+ controllers. |
Please avoid renaming routes in order to not break compatibility with those On Fri, 1 Apr 2016, 00:27 Vadim, notifications@github.com wrote:
|
First, old can be optimized and rewrtied with using laravel things. About structure: https://laravel.com/docs/5.2/eloquent - one table - one model (Entity) in next that can be easy adding relations with locales for example. If all going good for search we can use something like elasticsearch. |
👍 |
No we would have controllers as much we have entities in the databases. Next question is if we should realize a restful API. Should we change the TC-JSON-API to restful? In general yes we have to use the Laravel ORM to avoid security issues. Building queries is too unsecure. We also have to create for each entity a controller (Item is an entity, Achievement is an entity etc). Then we should provide a consistent structure for routing. To avoid compatibility issues we can also implement the old routes. In my example I did it like this: https://github.com/xTurinx/TC-JSON-API/blob/master/app/Http/routes.php << this are the new routes |
Current project is not RESTfull, currently that something like database viewer. |
I haven't said, that my structure is restful. |
Hi,
at first thank you for making an API for TC.
After I've looked at the code, I saw that you wrote the most of the application logic into routes.php.
At the moment the routes.php has about 1700 lines of code. In my opinion this is bad for the maintainability.
Do you have a specific reason why you did this so?
Would you merge a pull request if I change the structure into multiple controllers?
The text was updated successfully, but these errors were encountered: