Vanilo 6.0 Released.See what's new
WARNING! You're browsing the documentation of the upcoming version of Vanilo. It may contain unreleased features and changes, or even features that will not be present in the next release as described here. The latest stable version is 6.x
On this page
Admin Users
1 min read

Users

The users in Vanilo are built with the default Laravel user model + auth scaffolding.

Vanilo adds some extensions, namely:

  • The is_active flag;
  • The activate() and inactivate() methods;
  • The UserType enum (admin or client);
  • Login data;
  • Model related events;
  • SoftDelete;
  • Profile

Laravel Auth Support

In order to keep Laravel auth working but use the extended User model, you should modify your App\Models\User class:

namespace App\Models;

// No need to use Laravel default traits and properties as
// they're already present in the base class
class User extends \Konekt\AppShell\Models\User
{
}

And add this to you AppServiceProviders's boot method:

$this->app->concord->registerModel(\Konekt\User\Contracts\User::class, \App\Models\User::class);

Alternatively,

you can also delete App\Models\User and tell Laravel auth to use Vanilo's class.

Modify your app's config/auth.php file:

    //...
    'providers' => [
        'users' => [
            'driver' => 'eloquent',
            // 'model' => App\Models\User::class <- change this to:
            'model' => Konekt\AppShell\Models\User::class,
        ],
    //...

User's Active Status

The User model has an is_active boolean attribute, that is true by default for newly created users.

You can inactivate a user with the following method:

$user->inactivate();

This will emit a UserWasInactivated event.

An inactive user can be activated with:

$user->activate();

This will emit a UserWasActivated event.

User Type

The $user->type field is a UserType enum that can be either:

  • 'client' (default)
  • 'admin'

Vanilo doesn't permit non-admin users to log in to the admin panel.

For modifying the UserType enum, refer to the enums section.

Login Data

Users have two login related fields:

  • last_login_at (datetime)
  • login_count (int)

Every time a user logs in, these two fields will be updated.

Events

The user module fires the following events:

  • UserWasCreated
  • UserWasActivated
  • UserWasInactivated
  • UserWasDeleted
Next in Admin Acl