Skip to content
Advertisement

Laravel not calling function inside if statement

In laravel 8 I’m trying to pass data to the view blade template. This is my code:

JavaScript

I thought that it should call the function inside [privatecar::class, 'list'] and return the results but it just returns Array ( [0] => AppHttpControllersprivatecar [1] => list ) . How should I do to call the function?

PS: I am using laravel8

Advertisement

Answer

$param2 in Route::get($param1, $param2) is callable, but param2 in view($param1, $param2) only accept key/value array. Call them by yourself like this:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement