Home > Mobile >  What type of variable is this in php laravel 5.8?
What type of variable is this in php laravel 5.8?

Time:09-05

I have a food ordering web application and I am trying to deduct the total amount of an order from my wallet. The total amount is saved in the "payment.blade.php" page using the following variable.

Total Amount: @{{ withDelivery }}

I have created a function, "pay_with_wallet($total)" in the Wallet controller that takes the total amount of the order as a parameter and returns a deducted amount from the wallet. But the total is not being passed to the function "pay_with_wallet($total)" from the "payment.blade.php" page.

This is the payment.blade.php page where I am trying to pass the total in the function

Can anybody tell me how to what type of variable "@{{ withDelivery }}" this is? And how can I pass it in a static function in my Wallet Controller?

CodePudding user response:

It is escaping the blade directive. The @ symbol will be removed by Blade; however, {{ withDelivery }} expression will remain untouched by the Blade engine, allowing it to be rendered by your JavaScript framework.

Take a look at official documentation: Blade & JavaScript Frameworks

CodePudding user response:

Since many JavaScript frameworks also use "curly" braces to indicate a given expression should be displayed in the browser, you may use the @ symbol to inform the Blade rendering engine an expression should remain untouched.

Blade:

<h1>Laravel</h1>
 
Hello, @{{ name }}.

Output:

Laravel

Hello, {{ name }}.
  • Related