<commit_before><?php namespace Anomaly\Streams\Addon\Module\Users\Ui\Table;

use Anomaly\Streams\Addon\Module\Users\User\UserModel;
use Anomaly\Streams\Platform\Ui\Table\TableUi;

/**
 * Class UsersTableUi
 *
 * @link          http://anomaly.is/streams-platform
 * @author        AnomalyLabs, Inc. <<EMAIL>>
 * @author        <NAME> <<EMAIL>>
 * @package       Anomaly\Streams\Addon\Module\Users\Ui
 */
class UsersTableUi extends TableUi
{

    /**
     * Set up the table class.
     */
    protected function boot()
    {
        $this->setUpModel();
        $this->setUpViews();
        $this->setUpFilters();
        $this->setUpColumns();
        $this->setUpButtons();
        $this->setUpActions();
    }

    /**
     * Set up the model.
     */
    protected function setUpModel()
    {
        $this->setModel(new UserModel());
    }

    /**
     * Set up the table views.
     */
    protected function setUpViews()
    {
        $this->setViews(
            [
                'all',
                [
                    'slug'    => 'active',
                    'title'   => 'module.users::ui.active',
                    'handler' => 'Anomaly\Streams\Addon\Module\Users\Ui\Table\View\ActiveUsersTableView',
                ],
                [
                    'slug'    => 'inactive',
                    'title'   => 'module.users::ui.inactive',
                    'handler' => 'Anomaly\Streams\Addon\Module\Users\Ui\Table\View\InactiveUsersTableView',
                ],
                [
                    'slug'    => 'blocked',
                    'title'   => 'module.users::ui.blocked',
                    'handler' => 'Anomaly\Streams\Addon\Module\Users\Ui\Table\View\BlockedUsersTableView',
                ],
            ]
        );
    }

    /**
     * Set up the table filters.
     */
    protected function setUpFilters()
    {
        $this->setFilters(
            [
                'first_name',
                'email',
            ]
        );
    }

    /**
     * Set up the table columns.
     */
    protected function setUpColumns()
    {
        $this->setColumns(
            [
                [
                    'heading' => 'Name',
                    'value'   => '{first_name} {last_name}',
                ],
                'username',
                'email.link',
                'last_login_at.valueAndDiffForHumans',
            ]
        );
    }

    /**
     * Set up table buttons.
     */
    protected function setUpButtons()
    {
        $this->setButtons(
            [<commit_msg>Eager load activation<commit_after><?php namespace Anomaly\Streams\Addon\Module\Users\Ui\Table;

use Anomaly\Streams\Addon\Module\Users\User\UserModel;
use Anomaly\Streams\Platform\Ui\Table\TableUi;

/**
 * Class UsersTableUi
 *
 * @link          http://anomaly.is/streams-platform
 * @author        AnomalyLabs, Inc. <<EMAIL>>
 * @author        <NAME> <<EMAIL>>
 * @package       Anomaly\Streams\Addon\Module\Users\Ui
 */
class UsersTableUi extends TableUi
{

    /**
     * Set up the table class.
     */
    protected function boot()
    {
        $this->setUpModel();
        $this->setUpViews();
        $this->setUpFilters();
        $this->setUpColumns();
        $this->setUpButtons();
        $this->setUpActions();
    }

    /**
     * Set up the model.
     */
    protected function setUpModel()
    {
        $this
            ->setModel(new UserModel())
            ->setEager(['activation']);
    }

    /**
     * Set up the table views.
     */
    protected function setUpViews()
    {
        $this->setViews(
            [
                'all',
                [
                    'slug'    => 'active',
                    'title'   => 'module.users::ui.active',
                    'handler' => 'Anomaly\Streams\Addon\Module\Users\Ui\Table\View\ActiveUsersTableView',
                ],
                [
                    'slug'    => 'inactive',
                    'title'   => 'module.users::ui.inactive',
                    'handler' => 'Anomaly\Streams\Addon\Module\Users\Ui\Table\View\InactiveUsersTableView',
                ],
                [
                    'slug'    => 'blocked',
                    'title'   => 'module.users::ui.blocked',
                    'handler' => 'Anomaly\Streams\Addon\Module\Users\Ui\Table\View\BlockedUsersTableView',
                ],
            ]
        );
    }

    /**
     * Set up the table filters.
     */
    protected function setUpFilters()
    {
        $this->setFilters(
            [
                'first_name',
                'email',
            ]
        );
    }

    /**
     * Set up the table columns.
     */
    protected function setUpColumns()
    {
        $this->setColumns(
            [
                [
                    'heading' => 'Name',
                    'value'   => '{first_name} {last_name}',
                ],
                [
                    'heading'  => 'Activation Completed',
                    'relation' => 'activation.completed_at.diffForHumans',
                ],
                'username',
                'email.link',
                'last_login_at.valueAndDiffForHumans',
            ]
        );
    }

    /**
     * Set up table buttons.
     */
    protected function setUpButtons()
    {
        $this->setButtons(
            [
{'fraction_non_alphanumeric': 0.13651685393258428, 'fraction_numerical': 0.0, 'mean_word_length': 1.2669779286926994, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 60, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3687066', 'n_tokens_mistral': 1578, 'n_tokens_neox': 1509, 'n_words': 231}