I’m doing a Laravel course on Codecourse. So far I have a Category model: A factory: And a test However, when I run the test, I get: What gives? The course is a couple of years old so I think there’re a couple of differences between Laravel versions, but this seems a bit more fundamental. Answer Y…
Query a model using a relationship
I have a model called unit that has this relationship In the UserData model there is a column called user_id which I am trying to put in my condition in my query. I am trying to do a query like this but there is no user_id column in the Unit table, only though the users relationship Answer Ended up doing
PHP Interoperability – Print statements not showing in command line
I am having issues with PHP not returning print statements from Fortran. The idea is that PHP executes a command to compile a Fortran file then runs it. You are asked to input a number via print statement, problem is there is none showing up to CMD but the program is working as intended – when I enter a…
if/else with setInterval auto-refreshing and on click refreshing event jquery?
Struggling to get this to work properly…Making an if/else statement with setInterval that if class is clicked, content refreshes, else content auto refreshes after a specific time period. This is what I have for just auto refreshing atm (which works perfectly): What I’ve tried to get a “clic…
How to restart loop with different variable in php/html
as you can see im doing a loop as below. There are 2 data set involved: How do i restart this same loop by using $transaction_list_completed as the variable in the foreach statement? Suggestion to copy the loop is not what im looking for (maybe if no other solution) as the html content for this Modal consists…
how to change array structure in laravel?
Hello everyone i get some problem when try learn php with laravel, there is the problem … i have an array structure like this : array:3 [▼ 0 => 16 1 => 19 2 => 15 ] how can u change …
Refresh selectpicker options after jQuery success is not working
I am trying to refresh a select after executing another jQuery. I am creating firstly the select options using cURL, which produces code like this. Then I have the HTML that looks like htis I am loading the options into the select with this jquery Which works fine. Then I have another script to delete an opti…
How to infer type of a dynamically instantiated class without using annotations?
I have a dynamic config where I’ve defined supported classes for usage: ‘registeredRequestParameters’ => [ SearchParameter::class, ReturnsParameter::class, OrderByParameter::class, …
How to pass error handling to a function in PHP?
I need to handle multiple types of error in many places in my PHP class in my Laravel project, and of course I don’t want to repeat error handling codes everywhere in my code. I have this code now: …
How to prepare data outputted from sql in php to run through the PHP machine learning Library
I am playing around with the LeastSquares regression algorithm from the PHP ML library. I can successfully run the code with the example given but when I try to run data from my database I get a blank screen returned and no error logs on the server. Here is the working example php file from the ML library: He…