<commit_before><?php

namespace Astral\Http\Controllers;

use Illuminate\Http\Request;

class PredicatesController extends Controller
{
    public function index()
    {
        return auth()->user()->predicates;
    }

    public function store(Request $request)
    {
        $this->validate($request, [
            'name' => 'bail|required|unique:predicates,name,NULL,id,user_id,'.auth()->id(),
            'body' => 'required',
        ]);

        return auth()->user()->predicates()->create($request->only('name', 'body'));
    }

    public function update(Request $request)
    {
        $predicate = auth()->user()->predicates()->findOrFail($request->input('id'));

        $this->validate($request, [
            'name' => 'bail|required|unique:predicates,name,'.$predicate->id.',id,user_id,'.auth()->id(),
            'body' => 'required',
        ]);

        $predicate->update([
            'name' => $request->input('name'),
            'body' => $request->input('body')
        ]);

        return $predicate;
    }
}<commit_msg>Apply fixes from StyleCI (#269)<commit_after><?php

namespace Astral\Http\Controllers;

use Illuminate\Http\Request;

class PredicatesController extends Controller
{
    public function index()
    {
        return auth()->user()->predicates;
    }

    public function store(Request $request)
    {
        $this->validate($request, [
            'name' => 'bail|required|unique:predicates,name,NULL,id,user_id,'.auth()->id(),
            'body' => 'required',
        ]);

        return auth()->user()->predicates()->create($request->only('name', 'body'));
    }

    public function update(Request $request)
    {
        $predicate = auth()->user()->predicates()->findOrFail($request->input('id'));

        $this->validate($request, [
            'name' => 'bail|required|unique:predicates,name,'.$predicate->id.',id,user_id,'.auth()->id(),
            'body' => 'required',
        ]);

        $predicate->update([
            'name' => $request->input('name'),
            'body' => $request->input('body'),
        ]);

        return $predicate;
    }
}
{'fraction_non_alphanumeric': 0.1944049312470365, 'fraction_numerical': 0.001422475106685633, 'mean_word_length': 2.65684575389948, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 51, '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': '2392564', 'n_tokens_mistral': 614, 'n_tokens_neox': 603, 'n_words': 92}