Hot answers tagged

5

I think you can DRY this up pretty well by refactoring. This feels like a “ifs are evil” code smell to me. There are three “if” statements within that whereHas. They are packed in fairly tightly, and it makes that part of the code more difficult to read. Trying to refactor that as much as possible can resolve the duplication along the way, and ultimately ...


1

Oh yes, I recommend some DRYing principles here. Don't ask php to do the same thing over and over for the same result in a loop -- execute those tasks, just once, before entering the loop. Rather than repeating whole portions of mark up only to change a few values, create a lookup array of the social networks that you want to cycle through and only replace ...


Only top voted, non community-wiki answers of a minimum length are eligible