PHPackages                             netcore/module-user - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. netcore/module-user

ActiveModule[Authentication &amp; Authorization](/categories/authentication)

netcore/module-user
===================

v2.0.2(8y ago)32.7k[2 issues](https://github.com/netcore/module-user/issues)PHPPHP &gt;=7.0

Since Nov 2Pushed 8y ago5 watchersCompare

[ Source](https://github.com/netcore/module-user)[ Packagist](https://packagist.org/packages/netcore/module-user)[ RSS](/packages/netcore-module-user/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (3)Versions (19)Used By (0)

Easier user management.
=======================

[](#easier-user-management)

Main idea of this package is to make user management more simple in CMS side. And also to provide simple socialite integration with additional traits and helpers.

Pre-installation
----------------

[](#pre-installation)

This package is part of Netcore CMS ecosystem and is only functional in a project that has following packages installed:

Instalation
-----------

[](#instalation)

```
composer require netcore/module-user

```

Publish config, assets, migrations. Migrate and seed:

```
php artisan module:publish-config User
php artisan module:publish User
php artisan module:publish-migration User
php artisan migrate
php artisan module:seed User

```

You need to add `UserPermissions` trait to your user model in order to be able to log in acp.

You should be good to go.

Features
--------

[](#features)

- You get user management section in your acp where you can create, delete, edit, show users. Also you can configure what actions are allowed to be done in User section. For example you disable deleting users in acp. In order to do so you need to navigate to `config/netcore/module-user.php` config file and change from true to false corresponding variables:

```
...
'allow' => [
        'delete' => false,
        'create' => true,
        'view'   => false,
        'export' => false,
    ]
...

```

- Also if you want to use socialite you can configure providers in `config/netcore/module-user.php`, also turno on and off socialite support. If you use socialite you need to add `UserSocialite` trait to you User model and `ControllerSocialite` to your AuthController.

It will seed settings for oAuth and you will be able to configure them in Settings section in your page.

Dont forget to add [Socialite](https://github.com/laravel/socialite) package to your composer.json file

In order to call socialite request you can use this url `/login/{provider}` where {provider} is replaced with facebook or google, depends on what you have choosen.

You need to add `providerCallback` method to your AuthController, in this method you will be able to manage data which you receive from provider.

```
public function providerCallback(string $provider)
{
    $this->providerGate($provider);
    try {
        $providerUser = Socialite::driver($provider)->user(); // Provider data
    } catch (Exception $exception) {
      return $this->handleBadProviderResponse($exception, $provider);
    }
}

```

### Exporting users

[](#exporting-users)

- First of all you need to configure export filters, add export data formatter to related model (if option with relation is required)
- At module-user.php config file

```
    'export_options' => [
        // Users only
        [
            'title'   => 'Users only',
            // Filters that can be appied to exportable data
            'filters' => [
                [
                    'name'     => 'Register date from:', // Filter name
                    'key'      => 'created_at_from', // Filter key (for html input - must be unique)
                    'type'     => 'date', // Field type
                    'field'    => 'created_at', // Column name in database
                    'operator' => '>=', // SQL select operator
                    'required' => false, // Is required?
                ],
                [
                    'name'     => 'Register date to:',
                    'key'      => 'created_at_to',
                    'type'     => 'date',
                    'field'    => 'created_at',
                    'operator' => '=',
                        'required'       => false,
                    ],
                    [
                        'name'           => 'To date:',
                        'key'            => 'created_at_to',
                        'type'           => 'date',
                        'field'          => 'created_at',
                        'operator'       => '
