S
S
Scronheim2017-01-15 19:43:09
Laravel
Scronheim, 2017-01-15 19:43:09

How to insert variable in laravel 5.3 request?

Have a request

$img_link_id = Img_link::insertGetId(
                    ['name' => 'https://img.youtube.com/vi/$down_link_id/hqdefault.jpg']
);

What is the correct way to insert the $down_link_id variable into this request?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2017-01-15
@scronheim

"https://img.youtube.com/vi/$down_link_id/hqdefault.jpg"

Use double quotes

E
entermix, 2017-01-15
@entermix

$img_link_id = Img_link::insertGetId(
                    ['name' => "https://img.youtube.com/vi/{$down_link_id}/hqdefault.jpg"]
);

php.net/manual/en/language.types.string.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question