Questions tagged [controller]
A controller is responsible for executing a sequence of instructions in response to some stimulus (maybe a command, action, or event). This is often used in conjunction with the Spring or model-view-controller tags.
0
votes
1answer
15 views
Laravel limit by ID
I have this code to get all of my messages from my database. All messages contains a room_ID
Now I want to have like the latest 20 messages of each room. So If I go to localhost:8000/api/messages ...
0
votes
0answers
18 views
How to update attributes of a selected tab in rails?
I have a main tab 'Category'. This tab has two more tabs as 'question' and 'answer'. I have created CategoryController, in which I have defined a show action. I have a method category_type in private ...
0
votes
1answer
23 views
Getting the constant name of a controller from params[:controller]
I have
params[:controller] # => "posts/comments"
and I would like to get the constant name of the related controller:
Posts::CommentsController
I know I can make this:
"#{params[:controller]....
0
votes
0answers
8 views
How to detect Gear VR controller's touchpads gesture?
These movements, i want to detect themWhen i was using windows 8 my laptop's touchpad were doing these things when i swipe from left to inside of the touchpad. Like changing the window or left to ...
0
votes
2answers
29 views
ruby on rails I need to build an object from api data
I want to create an object from data API. At first, the user will have to enter his immaticulation number. Once registration typed him return the following data in the view show
vehicles_controller:
...
0
votes
4answers
46 views
Update multiple columns
I want to update multiple product_variant of one product. At same time I also update product name.
What I am updating is:
Product-> name
Product_variant(can be multiple)->name & price
Code ...
1
vote
1answer
42 views
FLUTTER scroll multiple widget
if i have two (or more) scrollable widgets (say, SingleChildScrollView),
how do i make them BOTH scroll at the same time?
because i will be Stacking them on top of each other,
so one is covered by ...
-2
votes
1answer
38 views
function getDoctrine won't work in one specific function of a controller
EDIT: now trying to use an EventSubscriber as b.enoit.be advised me. But when I send a mail, nothing happens. I don't get any error, but the mail isn't stored in my database either. And I tested What ...
-1
votes
2answers
23 views
Laravel: 2 models 1 controller
Not necessarily Laravel-only related but, I'm working on a website where users can register and, if they want, they can subscribe to a paid plan.
If they don't subscribe, they can still navigate the ...
0
votes
3answers
51 views
How to call controller's update function
I am trying to use controller's update function on my dashboard.blade.php page, but when I press on "Save" it switches to show.blade.php page instead of updating.
My dashboard.blade.php page:
...
0
votes
1answer
29 views
Laravel 'Auth::user()' displaying false in '__construct' of a controller [duplicate]
Problem
Laravel's method Auth::check() is returning false in the __construct method of my controller but its returning true in any other method used (While i'm logged in of course). I'm assuming the ...
0
votes
0answers
20 views
(Laravel) How to pass an ajax success callback value into ConsoleTv Charts?
I have this return value by ajax and I pass it to console in the mean time because I don't know how to render the data back to my ConsoleTv Charts again.
Here is a screenshot of the returned chart ...
1
vote
0answers
47 views
JavaFX Calling a Method from Another Controller
I have a TabPane with multiple Tabs, each Tab has its own fxml file and controller. Now I'm trying to access a method (inside of controller A) from controller B.
e.g. whenever the handleAddClick() ...
0
votes
0answers
8 views
LIXADA uDMX simple DMX controller in C#
I have a LIXADA uDMX USB controller. I want to make a really simple DMX controller in C#. I only want to control a lamp's brightness, and it's a moving head lamp, so I want to give it x and y ...
0
votes
0answers
15 views
Spring Boot Controller Method(endpoint) returning CompletableFuture<String>
I have this Method in my regular controller(not Rest). This code runs when create a get request to my home page. I used to have this code working with just returning the String"view/MainView", which ...
0
votes
1answer
21 views
Sorting collections in Laravel
I've got a little problem with my Laravel controller and sorting it:
public function index()
{
$achievements = Achievement::all();
$news = News::all();
$livingspaces = Livingspace::all();
...
0
votes
0answers
28 views
Symfony: Deny User Access (based on assigned database entries)
My Symfony project has following classes:
User
Project
Every user is assigned to one or more projects (per database).
The overall route to access a project is: localhost/project/2 (project with id ...
0
votes
1answer
26 views
How can I display a List<String>?
I have a List and I want to print this list via system.out.println()
My query in my repository is like this :"
@Query("select groupe, AVG(tauxCharge) from EquilibrageFrequentiel E where
...
0
votes
0answers
12 views
ServiceNow many get requests in Spring controller
Whenever I have the following calls in one getmapping method in my restcontroller made in Spring boot, it never gets executed.
It works perfectly when I comment out one out of the three.
It doesn't ...
0
votes
1answer
35 views
Testing return value of Controller method variable in Rspec
In Rails app, I am Writing Rspec Test cases.
I have a controller file, which has a method called 'index' and this returns some values to the views file which is used as a header value to some table ...
0
votes
1answer
27 views
undefined method `posts' for nil:NilClass error
I am getting this error:
undefined method `posts' for nil:NilClass
I have a model Post, here is my PostsController
def new
@post = current_user.posts.build
end
def create
@user = ...
-1
votes
0answers
19 views
Unity3d animation based movement platformer game
can someone help me to find solution?
Player movement in our game is animation based.
Walk animation moves player from start at 0X to 1X where animation ends.
Exit time is 1, no loop.
When walk or ...
0
votes
0answers
53 views
Spring Boot fails to return JSON for a object but not for list of objects
I am developing my first Spring Boot application and i ran into a weird problem. The configuration is very basic:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven....
0
votes
1answer
36 views
Unit Testing of Remote API calls, How it works with JSON Objects
In my web api, I have a method that call a service that return a deserialized JSON object. I can't find a way for unit testing that is working for me.
the following is the code from the controller:
...
0
votes
1answer
18 views
java scenebuilder bmi calculator
so I've been working on a javaFX & Scenebuilder project to create a BMI calculator, and seem to have gotten a bit stuck. Any tips/recommendations about what I should do?
One of the requirements ...
0
votes
2answers
39 views
Trying to get property 'name' of non-object
In code Controller recieving data from model but failed to show in blade view file.
This is blade view code.
@for($id = 0;$id < 59;$id++)
@foreach($data[$id] as $data)
{{$data->name}...
0
votes
1answer
32 views
(Laravel) Can I pass a dropdown value directly into a controller method?
All I want is to pass a dropdown value directly to my controller method. Is there any possible ways to do this or are there any documentations or tutorials on how to do this? By the way, I'm using ...
0
votes
1answer
39 views
How do you route to vanilla php scripts in Symfony4?
I found a great library that I want to use (https://github.com/pqina/filepond-server-php) but it it's just a bunch of vanilla php scripts, some classes, some not.
They work fine but I don't know how ...
0
votes
1answer
25 views
Creating a controller method that saves an object within an object
I am trying to create a controller for a microservice in which a vehicle object is created, however within this vehicle object, we must save a registration object first. I am able to do the vehicle ...
0
votes
0answers
13 views
I want to return Count of a Collection in addition to the other elements of a table in the database
I want to also return in addition to the parameters of the Buyers Class I want to return the number of properties owned by the buyer using a GET method in the controller.
How can I change the GET ...
0
votes
1answer
16 views
How to write Laravel eloquent query inside model function?
Actually I don't know how to retrieve data from db using function and query inside model .Please help me what should i add inside model function.
Here is controller
public function checkAdmin(...
0
votes
1answer
14 views
Moving data from controller to res.render
I am wondering how I can take and do something like return res.status(400).json({message: 'This is my message'}) in a controller/middleware then I want to be able to in a callback or another custom ...
0
votes
0answers
16 views
Ethernet IP and Python Cpppo
I am trying to access the status of Plc controller tags from AB 1759 controller ethernet IP using Python cpppo library. However i end up with result None. The code is as below
from cpppo.server.enip ...
0
votes
1answer
19 views
How to fix "undefined method `empty?' for #<ContactInformation:0x007fc8be45cc98>: error?
I had has_many association between a user and contact_information. I added two columns to contact_information as address_one and address_two. And then changed the association to has_one association ...
1
vote
2answers
49 views
Laravel - passing parameters from web.php routes to controller
I am trying to pass a parameter to my UserController but i can't seem to find a method to do this. All other topics give examples where the parameter is already defined in the url but that is not what ...
0
votes
3answers
46 views
How to make route to save data in users table in Laravel 5.7?
I am working with Laravel 5.7 and do not go Auth command and make Login and Registration. but I have UserController and save data in users table as following.
protected function create(array $data)
...
0
votes
0answers
34 views
Initialize array using Javascript function
I have created an HTML page that will allow me to add and remove itinerarys from a list using JS. I have defined an array with 5 different itinerarys.
What I want to do is make a function that ...
0
votes
0answers
10 views
Razor view Multiline Titile
Passing tile for view from Controller using:
ViewBag.mytitle = "MY Department + +
"My Division " + " Someone, Materials Engineer " + " *** AGGRERGATE TEST REPORT ***"...
0
votes
1answer
36 views
Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No message throw new MethodNotAllowedHttpException($others);
Ok so trying to submit a form in Laravel, but keep getting this issu
Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException
No message
I check all my code to see what could be ...
-2
votes
2answers
43 views
How to test controller method in Symphony with phpunit?
I am developing my application now and I want to integrate the unit test. if possible I want to test controller methods already written in my application
0
votes
1answer
20 views
How to call a function from a seperate file and controller in angular js ? is it possible?
For example I have my test.js which contains the controller testCtrl that has a funtion for example from below code. Can I access and use/call
that function which is get_data on my test2.js which ...
0
votes
1answer
20 views
Generic object (json) catcher in Mvc controller?
Is it possible to create a generic Mvc controller that catches any simple Json object from a web page post and can then be interrogated for keys/values, eg
public JsonResult SaveData(Dictionary<...
-2
votes
0answers
24 views
Ruby Sinatra - Trying to make a search bar - ERROR = undefined method `each' for nil:NilClass
I'm trying to integrate a search bar under views/projects/index.erb and I'm getting either a NoMethodError and a blank screen at best when trying to search for existing projects.
This is for sinatra, ...
1
vote
1answer
29 views
How to pass a looped dropdown value from view to controller using route in Laravel?
I have this dropdown with looped item in it. All I want is when I change the value of the selected item on dropdown it will send the value to the controller using route.
This is the code of looped ...
-1
votes
0answers
41 views
Creating default object from empty value — Array value
I got the title as error:
I try to pass value array from file1.php to file2.php controller.
as:
file1.php
return array(
'params'=>array('adminEmail'=>'email@email'),
...
1
vote
2answers
36 views
Angular.js Controller Naming Approach
I am developing an app in Angular v1.x, with the following scenario.
A user (seller) can offer an item to a buyer
A user (buyer) can accept or decline the offer
When a user clicks to add an offer (1)...
0
votes
1answer
39 views
Service and controller layer exception handling design pattern
So here is my current implementation of a rest-api endpoint, I would like to handle some kind of corner cases, for example the user or the flat is not found, so I would throw and suitable exception, ...
4
votes
0answers
67 views
What is the proper way to pass parameter from one mapping to another?
What I am writing is an application about shops. Let's say that I have a form with few fields. My product has:
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ShopFormDto {
...
0
votes
0answers
12 views
How can I read a controllers input through I2C?
So i'm working on a project. It's basically a quiz. 1 question and 4 possible answers.
There will be a max of 10 players. Everyone of them has a "controller" with 4 buttons. A yellow, green, red and ...
0
votes
1answer
29 views
How to reuse laravel controller code in custom command
I have controller file that has a function login() that logs in(authenticates and returns a token) to some third party portal. Now i want to reuse that controller function in a custom command. Please ...