I tried to use the helper function array_sort()
, but it returns an undefined function error. Please see my code below.
DashboardController
dd(array_sort($get_all_available_city));
I've created helpers.php
by the way. Maybe it affects the functionality. But didn't override the array_sort()
, and also I didn't put namespace on it.
UPDATE
I'm using laravel 7.
You can't use string and array helpers from Laravel 6. laravel 6 removed helpers function from repo. You can use Illuminate\Support\Arr classes for helpers.
use Illuminate\Support\Arr;
Arr:::sort($get_all_available_city);
If you want to use helpers functions as array_sort then you need to install new composer package with following command :
composer require laravel/helpers
Then you can access :
array_sort($get_all_available_city);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With