<commit_before><?php

namespace App\Http\Controllers;

use App\Http\Requests\BaseRequest;
use App\Models\Server;
use Illuminate\Support\Facades\Log;

final class ServersController extends ProjectChildController
{

    public function __construct(BaseRequest $request, Server $model)
    {
        parent::__construct($request, $model);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @param number $project_id Project Id
     *
     * @return \Illuminate\Http\Response
     */
    public function create($project_id)
    {
        $project = $this->project->getUserModel($project_id);
        return view('pages.server_form', [
            'model' => $this->model,
            'project' => $project
        ]);
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param number $project_id Project Id
     *
     * @return \Illuminate\Http\RedirectResponse
     */
    public function store($project_id)
    {
        $project = $this->project->getUserModel($project_id);
        $path = $project->repo_path;
        $key = $project->user->auth_key;

        $this->validate(
            $this->request,
            $this->model->getValidationRules(null, ['branch'=>"branch:{$path},{$key}"])
        );

        $data = $this->request->all();
        $data["project_id"] = $project_id;

        $model = $this->model->newInstance($data);<commit_msg>Fix validateBranch rule called in ServerController<commit_after><?php

namespace App\Http\Controllers;

use App\Http\Requests\BaseRequest;
use App\Models\Server;
use Illuminate\Support\Facades\Log;

final class ServersController extends ProjectChildController
{

    public function __construct(BaseRequest $request, Server $model)
    {
        parent::__construct($request, $model);
    }

    /**
     * Show the form for creating a new resource.
     *
     * @param number $project_id Project Id
     *
     * @return \Illuminate\Http\Response
     */
    public function create($project_id)
    {
        $project = $this->project->getUserModel($project_id);
        return view('pages.server_form', [
            'model' => $this->model,
            'project' => $project
        ]);
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param number $project_id Project Id
     *
     * @return \Illuminate\Http\RedirectResponse
     */
    public function store($project_id)
    {
        $project = $this->project->getUserModel($project_id);
        $path = $project->repo_path;
        $key = $project->user->auth_key;

        $this->validate(
            $this->request,
            $this->model->getValidationRules(null, ['branch'=>"gitBranch:{$path},{$key}"])
        );

        $data = $this->request->all();
        $data["project_id"] = $project_id;

        $model = $this->model->newInstance($data);
{'fraction_non_alphanumeric': 0.13955119214586256, 'fraction_numerical': 0.0, 'mean_word_length': 2.504914004914005, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, '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': '5888706', 'n_tokens_mistral': 823, 'n_tokens_neox': 830, 'n_words': 166}