<commit_before><?php

namespace Milax\Mconsole\Http\Controllers;

use App\Http\Controllers\Controller;
use Milax\Mconsole\Http\Requests\UserRequest;
use App\User;
use Milax\Mconsole\Models\MconsoleRole;
use Request;
use Filterable;
use Paginatable;
use Redirectable;
use HasQueryTraits;

class UsersController extends Controller
{
    use HasQueryTraits, Redirectable, Filterable, Paginatable;
    
    protected $redirectTo = '/mconsole/users';
    protected $model = 'App\User';
    
    public function __construct()
    {
        $this->roles = MconsoleRole::notRoot()->get()->lists('name', 'id');
    }
    
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $this->setText(trans('mconsole::users.filter.email'), 'email', true)
            ->setText(trans('mconsole::users.filter.id'), 'id', true)
            ->setSelect(trans('mconsole::users.filter.role'), 'role_id', $this->roles, true);
        
        return $this->setPerPage(20)->run('mconsole::users.list', function ($item) {
            return [
                '#' => $item->id,
                trans('mconsole::users.table.updated') => $item->updated_at->format('Y'),
                trans('mconsole::users.table.email') => $item->email,
                trans('mconsole::users.table.name') => $item->name,
            ];
        });
    }<commit_msg>TG-39 #closed<commit_after><?php

namespace Milax\Mconsole\Http\Controllers;

use App\Http\Controllers\Controller;
use Milax\Mconsole\Http\Requests\UserRequest;
use App\User;
use Milax\Mconsole\Models\MconsoleRole;
use Request;
use Filterable;
use Paginatable;
use Redirectable;
use HasQueryTraits;

class UsersController extends Controller
{
    use HasQueryTraits, Redirectable, Filterable, Paginatable;
    
    protected $redirectTo = '/mconsole/users';
    protected $model = 'App\User';
    
    public function __construct()
    {
        $this->roles = MconsoleRole::notRoot()->get()->lists('name', 'id');
    }
    
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $this->setText(trans('mconsole::users.filter.email'), 'email', true)
            ->setText(trans('mconsole::users.filter.id'), 'id', true)
            ->setSelect(trans('mconsole::users.filter.role'), 'role_id', $this->roles, true);
        
        return $this->setPerPage(20)->run('mconsole::users.list', function ($item) {
            return [
                '#' => $item->id,
                trans('mconsole::users.table.updated') => $item->updated_at->format('m.d.Y'),
                trans('mconsole::users.table.email') => $item->email,
                trans('mconsole::users.table.name') => $item->name,
            ];
        });
    }
{'fraction_non_alphanumeric': 0.16019760056457305, 'fraction_numerical': 0.002117148906139732, 'mean_word_length': 2.7351778656126484, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, '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': '5040811', 'n_tokens_mistral': 865, 'n_tokens_neox': 859, 'n_words': 151}