Aleš
Aleš

Reputation: 79

Laravel and PHP Collator class

Why I can't use PHP Collator class in my Laravel controller (Laravel 8)?

When I use $collator = new Collator('sl_SI'); in config or view file it works OK, but when I try using it in controller I get error:

Call to undefined function App\Http\Controllers\Myapp\Collator()

Any suggestions?

Upvotes: 0

Views: 248

Answers (1)

Daan
Daan

Reputation: 26

I would guess you forgot to add the namespace

use Collator; 

at the top of your Controller.

If that isn't working, you should add some code examples.

Upvotes: 1

Related Questions