How can i use the parameter from Angular in Laravel blade?
I try this code:
<?php echo \Carbon\Carbon::createFromTimeStamp(strtotime(@{{user.lastseen}})->diffForHumans() ?>
and
{{\Carbon\Carbon::createFromTimestamp(strtotime(@{{user.lastseen}}))}}
But i got an Error any idea?
By default AngularJS and Blade conflict with the way variables are called. Both use a double curly bracket {{ var }}
syntax. There are a few workarounds such as changing Angular’s or Blade’s delimiters but an easier method is available.
Inside blade prefix Angular echo variables with the at “@“ symbol. Here is an example:
$var = \Carbon\Carbon::createFromTimestamp(strtotime(@{{user.lastseen}}));
@{{ $var }}
This will prevent blade from parsing it but will be correct when sent to the browser.