I'm looking for a bit of help or guidance here on how this should be done rather than spending hours throwing mud at the wall until something sticks.
I'm trying to learn Laravel while porting my existing PHP project over and there's a few hurdles i'm struggling with, mainly passing the data retrieved back to another function.
I currently have postal addresses in a database table with 7 fields for each line of the address.
The controller returns the correct data to the view, but some addresses have empty lines due to not having any info in that section, I'm guessing i would use the modal to do the actual PHP donkey work but i'm struggling to understand how i do this efficiently, my plan was to create a simple function with the code below in it
$fadd1 = (empty($add1) ? '' : $add1."<br />");
$fadd2 = (empty($add2) ? '' : $add2."<br />");
$fadd3 = (empty($add3) ? '' : $add3."<br />");
$fadd4 = (empty($add4) ? '' : $add4."<br />");
$ftown = (empty($town) ? '' : $town."<br />");
$fcounty = (empty($county) ? '' : $county."<br />");
$fpostcode = (empty($postcode) ? '' : $postcode);
Then i could reuse on other sections of the site but its the whole getting it from the view then sending it to the function then back to the view again in the desired format.
Any help would be appreciated.