Timeline for Search controller logic to search through models and manufacturers
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 3, 2022 at 18:44 | vote | accept | Hashim Aziz | ||
Feb 3, 2022 at 18:23 | comment | added | Hashim Aziz | @mickmackusa The solution definitely works but as I said I don't have much experience with programming logically so I don't know how well it works for edgecases. No, that wasn't the intention, it was just the best way I could figure out at the time of getting the relevant slug into a variable while also making sure what was being returned to the view was still a Collection. | |
Feb 2, 2022 at 22:44 | comment | added | mickmackusa | @Laurel I don't use laravel, so don't know if it is broken. I was just seeing several red flags. I don't know if those queries might return multiple results -- if so, it is not working as intended. If you say it is not broken, okay. | |
Feb 2, 2022 at 22:39 | comment | added | Laurel | @mickmackusa The code is for searching and it does that, so I think the question is on-topic, based on meta which says in order to be off topic code has to be "very obviously broken (won't run at all, or fails on a simple test case)". | |
Feb 2, 2022 at 22:17 | answer | added | Laurel | timeline score: 3 | |
Feb 2, 2022 at 21:24 | comment | added | mickmackusa |
This looks questionable: foreach ($results as $result) { $slug = $result->manufacturer->slug; } ...is the intention to keep overwriting the $slug variable in a loop and only preserve the final value? This technique is repeated two more times in your code. Please explain. And $results keeps getting overwritten. Lots of red flags on this question to be honest. I'm leaning toward "Not Working As Intended".
|
|
Feb 2, 2022 at 20:54 | comment | added | Tpojka | Maybe you can also inspect these two packages and see what they did there. | |
Feb 2, 2022 at 20:17 | history | asked | Hashim Aziz | CC BY-SA 4.0 |