Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [controller]

In MVC architecture (Model-View-Controller), the object responsible for passing and receiving data to and from views, acting as a bridge between the "Model" and the "View".

Filter by
Sorted by
Tagged with
2 votes
1 answer
517 views

MVC controller and action that handles favorite items in a session-based list

I've written a Controller and a corresponding Action for a Symfony 2.8 project, that does the following: handles a list of favorite items of a user the ids of the favorites are stored in the session ...
lampshade's user avatar
  • 245
2 votes
1 answer
2k views

Implementing delegate methods in an UIView class

This is my UIView class: ...
Hapeki's user avatar
  • 133
3 votes
1 answer
185 views

Rails 5 controller to get information about Steam users

I've done a bit of modifications and finally got it working, and did a lot of reading about @ vs @@ vs just declaring and I came ...
DNorthrup's user avatar
  • 285
3 votes
1 answer
135 views

Initializing a controller that uses Selenium

I've outsourced the setup functions from my class to another file, I outsourced initDriver from the class PortalController to ...
Black's user avatar
  • 243
4 votes
1 answer
991 views

Laravel - Revised Authentication Controller

I'm developing a Social Engineering Awareness Training Application. This is the focus of my thesis for my undergraduate degree. This will be a multi-part review request, however, if you want to see ...
Trojan404's user avatar
  • 818
5 votes
1 answer
191 views

Email Controller

I'm developing a Social Engineering Awareness Training Application. This is the focus of my thesis for my undergraduate degree. This will be a multi-part review request, however, if you want to see ...
Trojan404's user avatar
  • 818
5 votes
1 answer
709 views

Laravel - Authentication Controller

I'm developing a Social Engineering Awareness Training Application. This is the focus of my thesis for my undergraduate degree. This will be a multi-part review request, however, if you want to see ...
Trojan404's user avatar
  • 818
4 votes
1 answer
2k views

REST API that allows creating/removing users, CRUD ToDo tasks

My project is supposed to be used as back-end for a simple to-do web app that lets you create an account, add, edit, complete, and delete todos. It could be used with some front end consumer like ...
doublemc's user avatar
  • 285
-2 votes
1 answer
79 views

How to optimize the below code in order to reduce the space and time to execute? [closed]

Am using the datasource which is from the MVC controller method "GetRepairIssues" in the client side to bind the options to the dropdownlist. The result comes as expected. I have to do it even better ...
Rajesh M's user avatar
7 votes
1 answer
958 views

C# Rental Program

I knew a little Java, and thought what the hell, I'll help my school and design this program that'll help checkout phone chargers and calculators and things to students. So I got in way over my head, ...
John Russell's user avatar
6 votes
1 answer
21k views

Spring MVC dynamically adding form elements

I made a simple form with an option of adding one text field dynamically on mouse click. And I will be grateful for suggestions on how I may improve the code. ...
Ivan T's user avatar
  • 61
1 vote
0 answers
1k views

Creating JavaFX bindable property readed from joystick

I'm lately messing up with handling joystick in java. So here is the thing. I wrote a simple class that handle input from joystick, but I'm no certain if I'm doing it well. Here is what I want to ...
user avatar
3 votes
1 answer
77 views

List enrolled users & show checkmark if all activities are complete

I'm a beginner with rails working on a rails 4 project to use with my students. Users enroll in lessons; on enrollment, four activities are created for each user (expositions, scrambled, dictations, ...
gonzalo2000's user avatar
1 vote
1 answer
318 views

Laravel controller to update appointment requests

My question/refactor is similar to what is found here: Laravel controller for form validation skinny However, I feel that the answer is for 5.0 and not 5.2. This question does not pertain only to one ...
azngunit81's user avatar
  • 1,210
10 votes
1 answer
222 views

Baseball player statistics controller

I'm somewhat new to JavaScript and AngularJS, and read in Doug Crockford's book that hoisted function declarations can lead to issues. If you have any pointers on how to structure my file, those would ...
dusk's user avatar
  • 101
2 votes
1 answer
378 views

Simple PHP MVC framework

I recently wrote this PHP MVC framework. Would like your review. index.php ...
simplfuzz's user avatar
  • 151
10 votes
1 answer
184 views

ASP controller for tracking equipment

This was originally posted here. I'm hoping Code Review will be a little more helpful in giving me a concrete direction. I've been working on a project based off of this tutorial. Unfortunately, ...
J Hache's user avatar
  • 161
1 vote
1 answer
2k views

Rails Grape API Endpoint optional params validation in update

I have the following rails grape api endpoint in the users resource: ...
Randall Valenciano's user avatar
2 votes
1 answer
1k views

Table View Controller for selecting and saving user default preferences in an iOS app

This is the Swift code from one of the view controllers in my app that calculates a one rep maximum weight a person can theoretically lift. This particular view controller presents a list in a ...
Jim's user avatar
  • 185
3 votes
1 answer
63 views

Extracting queries from controller to model

I had a complex query in the controller like: ...
Szilard Magyar's user avatar
2 votes
1 answer
61 views

Redirecting to the appropriate URL for some type of notification

I have a polymorphic notification model with action attribute. When user clicks on a notification he/she should be redirected to given page the notification refers to through notifiable. What is the ...
Szilard Magyar's user avatar
5 votes
2 answers
129 views

Rails controller to manage EC2 instances

I did a small sample application for an Interview. Since I didn't got accepted I would like your opinion on how to improve it. The aux methods are private. I have a ...
Manoel Rebelo Abranches's user avatar
2 votes
1 answer
600 views

Polymorphic event notification model in Rails

I have a polymorphic notification model. When user gets a notification he can get on the page of the notifiable to check out what happened exactly. For instance ...
Szilard Magyar's user avatar
3 votes
1 answer
149 views

Spring controller code to group information by date

I'm using the Spring Framework in my web application and I'm curious as to whether my controller implementations are good or not. I've used many Hashmaps to make a object that serves my purpose for ...
Nick Gajera's user avatar
2 votes
1 answer
358 views

Conversational bot architecture

I am currently building a small conversational bot, and I am struggling with the architecture. I use Facebook Messenger combined with Wit.ai's API and a Shopify store API. My rails app is the ...
Graham Slick's user avatar
2 votes
1 answer
121 views

Controller to update a catalogue through an uploaded Excel file

The goal of following MVC controller code is to achieve following workflow: User exports catalog (either with items of type Spread or of type Consumables) to Excel; User makes changes in exported ...
CheerfulCalf's user avatar
1 vote
2 answers
108 views

Controller method to manage SMS subscriptions

I have a huge method in my controller that is not DRY and just could use some general TLC. I'm new to ruby and I have not refactored my own code before, only contrived code you find on tutorials. ...
user avatar
2 votes
3 answers
11k views

AngularJS controller to fetch and display employee data from database

This is the code for an AngularJS controller that I've written: ...
cst1992's user avatar
  • 151
6 votes
1 answer
2k views

Drawing Routes on a Map

I have this class: ...
iCantSeeSharp's user avatar
1 vote
1 answer
56 views

Updating an auto-generated invoice (future) when current plan changes

I've built-out a mechanism to go and find an auto-generated invoice and update it with new information when a plan is changed or if users are added to the plan for the current billing period. It will ...
Tony Gaeta's user avatar
2 votes
1 answer
927 views

Simple calculator in PHP utilizing MVC

I have been struggling with understanding Model, View, Service, Controller architecture and wrote some code. Is my Model class the Model part of MVC (did I define ...
Dennis's user avatar
  • 271
3 votes
0 answers
70 views

Fat Controller Action - Deep nested filters

I have this really really long controller action and would like someone to help me break it down. ...
Filipe Chagas's user avatar
1 vote
1 answer
578 views

Laravel 5 controller to list appointments by date range and by label

I am starting to get into OOP using PHP and MVC. I just want to know if this code is good practice. Is this how I should be using my controller and model, in its simplest form? AppointmentsController:...
Hardist's user avatar
  • 377
1 vote
1 answer
78 views

Angular Box Color Exercise

I have completed an exercise where there are 4 different color boxes and 1 main box below them that is blank, when you click on one of the colored boxes, the main box changes to the color of the box ...
WinchenzoMagnifico's user avatar
8 votes
2 answers
3k views

Sails.js controller method for an admin to update a user account

I am new to Sails.js, Node.js, and web application development in general. My current understanding is that well-written controllers should be "skinny" meaning they should be as simple as possible, ...
Adam's user avatar
  • 191
4 votes
2 answers
2k views

CakePHP static pages (without entity) but with dynamic content

I have a few pages that is not connected with entities (index page, terms of use page, email page). Detailed description: In CakePHP, when you want to have a static page (such as index for example), ...
Ricardo's user avatar
  • 265
2 votes
0 answers
140 views

Controller method to add a product, stored across three database tables

I have some questions on how I can improve this "add" action method in a controller. Using a single form, the user can upload a product to be displayed on the site. A Product is composed of three ...
Ricardo's user avatar
  • 265
4 votes
1 answer
145 views

CakePHP change 'miniMap' action and respect template

I have some questions on how I can improve this "action" (method) in "controller": My template has a navbar with dynamic content (if the user is logged in a special button appears, his name appears ...
Ricardo's user avatar
  • 265
2 votes
1 answer
736 views

Price calculator for motors and pumps

Note This question was born in request to post more details from this question on Programmers. Since details may uncover new/different complexity, I'm asking another question here. I also will use ...
Dennis's user avatar
  • 271
3 votes
1 answer
50 views

Controllers for interacting with a vacation service

I have a controller called VacationController; in this controller, I retrieve a list of vacations which will be displayed in a grid. In the grid, I have the option to create a new vacation through a ...
DAG's user avatar
  • 199
2 votes
1 answer
144 views

Handling success and failure when retrieving product information

I've got an Angular controller where I have two functions that are repeated inside two functions: ...
Jonathan Solorzano's user avatar
1 vote
1 answer
190 views

Monkey patch allowing virtual controller methods in PHP MVC application

I'm in the process of building a soon to be opensource CMS. 100% MVC. The basic idea is that a plugin should be able to add pages (read: methods) to a given controller, without needing to instantiate ...
r3wt's user avatar
  • 472
2 votes
0 answers
137 views

Business logic in controller

Led by the recently read premise "Lean controllers and fat models" I've come to the conclusion that my controller might be too fat at the moment. Basically, what I'm trying to achieve is simple Edit ...
wegelagerer's user avatar
2 votes
2 answers
73 views

Controller method to validate and save

I have built RESTful web services. The services endpoints have a similar logic: If the input validation succeeds, do a database operation and return the result. If the db operation fails, return the ...
ontk's user avatar
  • 121
2 votes
1 answer
563 views

AngularJS to-do list controller

I am new to Angular. Am I following best practices here? I understand controllers should not do too much. My controller seems to have a lot of logic here. Can I do anything to improve it? It is just a ...
asdf's user avatar
  • 217
1 vote
1 answer
62 views

Selecting orders submitted by a user, segregated by status

I have recently started using Laravel as my chosen framework. It is my first time using a framework. As I have made progress through my project, my controller methods have started to increase in size. ...
Jacob Hallas's user avatar
0 votes
1 answer
2k views

Laravel Controller including sort and search

I am using this code on my own personal website (my personal administration site) so it doesn't need any security and so on. I am not into learning everything about that yet, and although I do know a ...
Hardist's user avatar
  • 377
2 votes
0 answers
772 views

Interactive transition between view controllers

I have made an interactive transition controller in Swift in two different ways. This interactive transition controller is the parent class and I have few child classes which adapt the parent for ...
Nico's user avatar
  • 199
2 votes
2 answers
294 views

Rails controller method to create a customer with credit card info

I'm working on a Rails application that has a lot of logic in the controller that should be in the model. In the app/controllers/customers_controller.rb#create ...
Antarr Byrd's user avatar
2 votes
2 answers
846 views

Replacing an application service class with multiple command handlers

I have a Controller which uses an application service to accomplish its tasks. The service class is starting to grow big and developing multiple dependencies. So I am thinking of replacing the single ...
341008's user avatar
  • 125