I am learning laravel for last couple of days. Can not seem to figure out how to render dynamic anchor tag inside a ternary operator. Below is my code snippet:
@foreach($task_list as $task)
<td>{!! $task->completed? 'Yes' : '<a href="/task/complete/$task->id" >Mark as complete</a>' !!}</td>
@endforeach
Basically i am checking if a particular task is complete(via the $task->complete model attribute). If yes then display the string "Yes", otherwise render a link that says "mark as complete". This link will take the user to a route "/task/complete/{id of the task}" where i will process it further.
I am unalbe the get the id of the task to be part of the link url(via the $task->id attribute). Would much appreciate some help and knowledge sharing