Laravel在字符串或DB中回显var

I have a string like this

<tr><td>{{ $name }}</td><td>{{ $number }}</td></tr>

and I echo it in a blade template.

In controller I return view('test',compact('name','number')).

But it is outputting like this

{{ $name }} {{ $number }}

How to get the value of $name and $number.

At the controller make your variables.

public function myAction()
{
    $number = 12 * 5;

    return view('test', [
        'name' => 'My name',
        'number' => $number,
    ]);
}

And then you can get these variables by calling in blade:

{{ $name }} - shows 'My name'.

{{ $number }} - shows number 60.