2019-05-14 07:52:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
2023-02-14 10:38:42 +00:00
|
|
|
use Illuminate\Support\Collection;
|
2019-05-14 07:52:49 +00:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
2021-12-10 06:31:03 +00:00
|
|
|
use LdapRecord\Configuration\DomainConfiguration;
|
2023-01-30 10:37:33 +00:00
|
|
|
use LdapRecord\Laravel\LdapRecord;
|
|
|
|
|
|
|
|
use App\Ldap\LdapUserRepository;
|
2019-05-14 07:52:49 +00:00
|
|
|
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
|
|
{
|
2023-01-30 10:37:33 +00:00
|
|
|
/**
|
|
|
|
* Register any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function register()
|
|
|
|
{
|
2021-12-10 06:31:03 +00:00
|
|
|
// Add a new option available to be set in the configuration:
|
|
|
|
DomainConfiguration::extend('name', $default = null);
|
2019-05-14 07:52:49 +00:00
|
|
|
|
2023-01-30 10:37:33 +00:00
|
|
|
// Use our LdapUserRepository to support multiple baseDN querying
|
|
|
|
LdapRecord::locateUsersUsing(LdapUserRepository::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Bootstrap any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function boot()
|
|
|
|
{
|
|
|
|
$this->loadViewsFrom(__DIR__.'/../../resources/themes/architect/views/','architect');
|
2023-02-14 10:38:42 +00:00
|
|
|
|
|
|
|
// Enable pluck on collections to work on private values
|
|
|
|
Collection::macro('ppluck', function ($attr) {
|
|
|
|
return $this->map(function (object $item) use ($attr) {
|
|
|
|
return $item->{$attr};
|
|
|
|
})->values();
|
|
|
|
});
|
2023-01-30 10:37:33 +00:00
|
|
|
}
|
|
|
|
}
|