D
D
daniel_wesson2020-02-01 22:40:04
Laravel
daniel_wesson, 2020-02-01 22:40:04

Is there any way to just render the blade string?

I have meta headers for products stored in the database like this:

Кроссовки купить по цене {{ $price }} в интернет-магазине ... с доставкой в {{ $city }}

How to simply process such a string with laravel methods?
I tried Blade compileString, but it doesn't work because it still generates raw php code, and I need a clean string in the output with substitution of price, city and all that. On the Internet, I can not find anything sensible on this topic.
You can, of course, work with regular expressions, but it seems to me somehow silly, given that a powerful template engine is at hand.
It seems to be the simplest task, but I've been stupid for the second hour

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
UksusoFF, 2020-02-01
@UksusoFF

(string)view('path.to.blade', [
  'price' => 100,
  //etc
])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question