I have a Laravel/ Angular application, and want to alter the contents of a PDF that's generated on one of the pages based on the content of the variables that will be displayed on that PDF.
The PDF is in the file reminder.blade.php, and currently has the content:
<html>
<head>
    ...
</head>
<body style="-webkit-font-smoothing: antialiased; font-family: 'Roboto'; font-weight: normal; margin: 0; padding: 0;">
    ...
</body>
</html>
I want to alter the content displayed in the <body></body> depending on the number of items to be displayed on the PDF, and the 'status' of those items, so I've surrounded the HTML for this with a PHP if statement:
<html>
<head>
    ...
</head>
@if(( count( {{ $transaction['transactionItem'] }} ) == 1) && {{ $transaction['transactionItem']['currentStatusId'] }} == '1010')
    <body style="-webkit-font-smoothing: antialiased; font-family: 'Roboto'; font-weight: normal; margin: 0; padding: 0;">
        ... Only first page of PDF here
    </body>
@else
    <body style="-webkit-font-smoothing: antaliased; font-family: 'Roboto'; font-weight: normal; margin: 0; padding: 0;">
        ... Full PDF content here
    </body>
@endif
</html>
However, when I now click the button to generate & download the PDF, I get an error in the Network tab of the console, that says:
Parse error: syntax error, unexpected '<' (View: /home/vagrant/code/resources/views/pdfs/prov/reminder.blade.php)
in 419cdd3906d761bc1bb55581502a15d04c1fe7a7.php line 8 at CompilerEngine->handleViewException(object(FatalThrowableError), 1) in PhpEngine.php line 46
which seems to either be complaining about the @if statement I've added in, or, according to the unexpected '<' answer here, is due to the fact that I'm using single quotes inside the double quotes on the <body ...> line... even though I am closing both correctly- at least as far as I can tell...
Anyone have any idea what I'm doing wrong here? How can I get the content of the PDF generated to be conditional, like I'm trying to?
