<commit_before><?php

namespace App\Http\Controllers;

use App\ServerSetting;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\User;
use App\BanReason;

class ServerSettingController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $settings = Auth::user()->server->settings;
        $servers = User::where("type","server")->get();
        foreach($settings as $setting){
            foreach($servers as $key => $server){
                if ($server == $setting->server){
                    $servers = $servers->except($key);
                    break;
                }
            }
        }
        return view('management.settings.index', ["server" => Auth::user(), "settings" => $settings, "servers" => $servers]);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create(Request $request)
    {
        $settingServer = User::find($request->get("server-id"));
        if ($settingServer->server != $settingServer){
            return redirect(route("settings.index"));
        }
        return view('management.settings.create', [ "settingServer" => $settingServer ]);
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $user = Auth::user();
        $server = $user->server;<commit_msg>Fixed setting index other servers list<commit_after><?php

namespace App\Http\Controllers;

use App\ServerSetting;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use App\User;
use App\BanReason;

class ServerSettingController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $settings = Auth::user()->server->settings;
        $servers = User::where("type","server")->get();
        $remainingServers = [];
        foreach($servers as $server){
            $found = false;
            foreach($settings as $setting){
                if ($setting->subject == $server){
                    $found = true;
                }
            }
            if (! $found){
                $remainingServers[count($remainingServers)] = $server;
            }
        }
        return view('management.settings.index', ["server" => Auth::user(), "settings" => $settings, "servers" => $remainingServers]);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create(Request $request)
    {
        $settingServer = User::find($request->get("server-id"));
        if ($settingServer->server != $settingServer){
            return redirect(route("settings.index"));
        }
        return view('management.settings.create', [ "settingServer" => $settingServer ]);
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $user = Auth::user();
        $server = $user->server;
{'fraction_non_alphanumeric': 0.1422209026128266, 'fraction_numerical': 0.0, 'mean_word_length': 2.2239234449760765, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '5893130', 'n_tokens_mistral': 902, 'n_tokens_neox': 923, 'n_words': 205}