All Questions
Tagged with controller php
51 questions
3
votes
2
answers
253
views
Laravel Event Filtering Controller
So I am currently writing a function in laravel that handles URL parameter filters.
How the code works: So we have the following two URL parameters:
timeframe and <...
2
votes
2
answers
250
views
'Lean controller'/'Business logic on service' and filtering, sorting, pagination methods on controllers
I'm currently reading about "Lean controllers"/"Business logic on services" and trying to refactor some legacy code. However I am struggling to apply what is taught in the ...
2
votes
1
answer
127
views
Controller in Laravel with parsing, creation and relationships
The following code represents the store method of a resource controller.
A user can create an training offer on my website and can pass various information like ...
1
vote
1
answer
73
views
Passing argument to a constructor and using it only in some class methods
I've created some controller for handling clicked links statistics. Does this class meet Single Responsibility Principle?
...
2
votes
1
answer
57
views
Laravel controller methods for registering businesses and stylists
I use the Laravel API and want make messy code cleaner.
I have a form for registering business and businessOwner.
And stylist who is working under this business registering from same function.
And ...
4
votes
1
answer
361
views
Codeigniter 3 micro-blogging application
I am working on a basic blog application in Codeigniter 3.1.8 and Bootstrap 4.
The application allows Registration (as an author), Login, adding Categories and Posts.
I have created an installation ...
1
vote
0
answers
703
views
Symfony controller to register and activate users
I've been in an interview some time ago. They objected my Symfony API code with following line:
Too much code in controller actions. Can be moved to services to keep
the business logic apart from ...
4
votes
1
answer
2k
views
Laravel voting system
I have written a voting class in Laravel. It uses the voting sites API to check if the user has voted today. A user is only allowed to vote once every day.
All votes reset at midnight (i.e. 12:00 AM ...
2
votes
1
answer
186
views
Codeigniter Controller for work orders
I'm working on a project and one of my controllers is getting quite large and hard to maintain or add to. I'm having trouble deciding what belongs in the controller and what I can move to the model. ...
1
vote
3
answers
1k
views
Laravel controller to manage sent and received messages
I write small inboxing app in Laravel 5.5 for my wesite. In inbox app users can compose new message, read messages and delete messages. I have only one table in my database for inboxes.
Structure of ...
3
votes
2
answers
617
views
Business logic inside MVC Cart Controller method
I have a controller method, invoked when a user adds the product he is viewing to the cart.
The way I understand how MVC works, this can be considered a fat controller already, but I'm still not ...
5
votes
2
answers
387
views
Request dispatcher for PHP JSON web service
Below you can find the constructor method and related fields of the main class of my REST API (note that the class contains more code than displayed) written in PHP 7.1. It does various things with ...
4
votes
1
answer
1k
views
Laravel LoginController
I have a LoginController in Laravel, but I think it could use some improving, can anyone tell me where I am going wrong? It just seems overall a bit messy, but I can't think of a logical way to ...
2
votes
2
answers
284
views
Laravel lumen : Post API method
Question is quite simple, I am using dingo package, Currently below is my code for an API call.
...
3
votes
1
answer
108
views
Performing CRUD between 4 tables
This code works perfectly fine but I have repeated many lines of code in this controller. I need some suggestions on how to optimize this code and remove repetition, with focus on the ...