Of course, as soon as I post that I come across {!! !!} as a means for outputting unescaped text. Ah the trials of a Laravel noob under tight production deadlines.
Convert string into HTML tags
Okay I know there has to be a simple way to do this but everything I've tried is working backwards. I am attempting to add subheadings to my sorted tables using a <td colspan=x class='subheader'> approach. However, I cannot for the life of me get the Laravel {{}} function to output text that a browser will properly interpret.
Here is my function:
function catTable($record,$nCols)
{
if(session()->has('seafood_category')) //IF WE'VE ALREADY SET IT, WE NEED TO CHECK IT
{
if (session()->get('seafood_category') == $record->seafoodCategory->category) //IF THE CATEGORIES ARE THE SAME
{
return ''; //NOTHING TO DO HERE
}
}
$cat=$record->seafoodCategory->category;
$html="<tr>
<td colspan='$nCols' class='subheader'>
$cat
</td>
</tr>";
session()->set('seafood_category',$cat);
return $html;
}
I've included this in a @foreach() loop in building my table and I'd like to insert the table row when the event is triggered. I know I must be missing something totally basic but I can't for the life of me find it. Any help would be greatly appreciated, thanks.
Please or to participate in this conversation.