Added Collect::recursive()

This commit is contained in:
Deon George 2018-04-24 16:42:02 +10:00
parent 6217dd53ea
commit 6df5f185a2
No known key found for this signature in database
GPG Key ID: 7670E8DC27415254

View File

@ -2,7 +2,6 @@
namespace Leenooks\Providers;
#use Acacha\User\Http\Middleware\GuestUser;
use Illuminate\Routing\Router;
use Illuminate\Support\ServiceProvider;
@ -24,6 +23,17 @@ class LeenooksServiceProvider extends ServiceProvider
{
$this->loadViewsFrom($this->_path.'/resources/themes/adminlte/views/', 'adminlte');
$this->loadTranslationsFrom($this->_path.'/resources/themes/adminlte/lang/', 'adminlte_lang');
// Enable a recusive() collection function so that we can just arrives in config/*.php
\Illuminate\Support\Collection::macro('recursive', function () {
return $this->map(function ($value) {
if (is_array($value) || is_object($value)) {
return collect($value)->recursive();
}
return $value;
});
});
}
/**