/** * Seed the admin account. */ private function seedAdminUser() { $adminUser = new User(['username' => 'admin', 'first_name' => 'Super', 'last_name' => 'ADMIN', 'email' => env('ADMIN_EMAIL', '*****@*****.**'), 'password' => env('ADMIN_PASSWORD', 'password')]); $adminUser->is_admin = true; $adminUser->is_active = true; if (UserConfirmator::isEnabled()) { $adminUser->is_confirmed = true; $adminUser->confirmed_at = Carbon::now(); } $adminUser->save(); /** @var \Arcanesoft\Auth\Models\Role $adminRole */ $adminRole = Role::admin()->first(); $adminRole->attachUser($adminUser); }
/** * Map routes. * * @param \Illuminate\Contracts\Routing\Registrar $router */ public function map(Registrar $router) { $this->bind('auth_user', function ($hashedId) { return User::firstHashedOrFail($hashedId); }); $this->group(['prefix' => 'users', 'as' => 'users.'], function () { $this->get('/', 'UsersController@index')->name('index'); // auth::foundation.users.index $this->get('trash', 'UsersController@trashList')->name('trash'); // auth::foundation.users.trash $this->get('roles-filter/{auth_role}', 'UsersController@listByRole')->name('roles-filter.index'); // auth::foundation.users.roles-filter.index $this->get('create', 'UsersController@create')->name('create'); // auth::foundation.users.create $this->post('store', 'UsersController@store')->name('store'); // auth::foundation.users.store $this->group(['prefix' => '{auth_user}'], function () { $this->get('/', 'UsersController@show')->name('show'); // auth::foundation.users.show $this->get('edit', 'UsersController@edit')->name('edit'); // auth::foundation.users.edit $this->put('update', 'UsersController@update')->name('update'); // auth::foundation.users.update $this->put('activate', 'UsersController@activate')->name('activate'); // auth::foundation.users.activate $this->put('restore', 'UsersController@restore')->name('restore'); // auth::foundation.users.restore $this->delete('delete', 'UsersController@delete')->name('delete'); // auth::foundation.users.delete if (UserImpersonator::isEnabled()) { $this->get('impersonate', 'UsersController@impersonate')->name('impersonate'); // auth::foundation.users.impersonate } }); }); }
/** * Get all cached users. * * @return \Illuminate\Database\Eloquent\Collection */ public function getCachedUsers() { return $this->cacheResults('users.all', function () { return User::all(); }); }