2 years ago

Trying to use Collect.js in contoller

Posted 2 years ago by tsaicharlie93

Hi, I am new to laravel. I am getting an error while using collect.js function that I cannot figure out.

my code in my controller is:

$users = User::all();
    $collection = collect($users);

my error is :

Call to undefined function App\Http\Controllers\sortBy()

Can someone tell me what is wrong?

or is collect.js not suppose to be used this way?


Please sign in or create an account to participate in this conversation.