Hello guys! :D
I have a problem with PHP function call_user_func() in Laravel project. I am testing this function in plain PHP (v 7.0) project and work, but in Laravel doesn't work.
What exactly I want?
I want take parametar from URL (this is a string OK?). When I take parametar (string), I put in function and call object and static method. It is a dynamic calling of objects. For example:
function call_user_func($param.'::all()')
$param is string from URL and representation my Model
all() is method
I get error:
call_user_func() expects parameter 1 to be a valid callback, class 'Brand' not found
P.S.
I include Brand class
use \App\Brand
Do you have solution how to call an object over a string?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire