public static function createAdmin($attributes) { $user = new User(); $user->attributes = $attributes; $user->role = self::ROLE_ADMIN; $user->password = crypt($user->password ? $user->password : mt_rand()); $user->token = $user->makeToken(); if ($user->save()) { $user->_sendAdminActivateEmail(); return true; } return $user->getErrors(); }