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?
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.