T
T
Taras Parashchuk2020-12-02 12:17:14
Laravel
Taras Parashchuk, 2020-12-02 12:17:14

How to pass variable to Laravel method?

$NUMBER = 533;
$result = vagprice::find($NUMBER); // doesn't find

$NUMBER = strval($NUMBER) // doesn't find
$result = vagprice::find($NUMBER); // doesn't find

$result = vagprice::find('533'); // finds

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2020-12-02
@taras1978

The problem is not the way the variable is passed. Nothing more can be said without the code.
Laravel itself casts the value to the string: https://github.com/laravel/framework/blob/aa81c2e5...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question