<commit_before><?php

/*
 * NOTICE OF LICENSE
 *
 * Part of the Rinvex Fort Package.
 *
 * This source file is subject to The MIT License (MIT)
 * that is bundled with this package in the LICENSE file.
 *
 * Package: Rinvex Fort Package
 * License: The MIT License (MIT)
 * Link:    https://rinvex.com
 */

namespace Rinvex\Fort\Http\Requests\Frontend;

use Rinvex\Support\Http\Requests\FormRequest;

class UserSettingsUpdateRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Process given request data before validation.
     *
     * @param array $data
     *
     * @return array
     */
    public function process($data)
    {
        if (empty($data['password'])) {
            unset($data['password'], $data['password_confirmation']);
        }

        return array_filter_recursive(array_trim_recursive($data));
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'email'    => 'required|email|max:255|unique:'.config('rinvex.fort.tables.users').',email,'.$this->get('id'),
            'username' => 'required|max:255|unique:'.config('rinvex.fort.tables.users').',username,'.$this->get('id'),
            'phone'    => 'required|numeric|unique:'.config('rinvex.fort.tables.users').',phone,'.$this->get('id'),
            'password' => '<PASSWORD>',
        ];
    }
}<commit_msg>Fix validation rules unique user id (close #68)<commit_after><?php

/*
 * NOTICE OF LICENSE
 *
 * Part of the Rinvex Fort Package.
 *
 * This source file is subject to The MIT License (MIT)
 * that is bundled with this package in the LICENSE file.
 *
 * Package: Rinvex Fort Package
 * License: The MIT License (MIT)
 * Link:    https://rinvex.com
 */

namespace Rinvex\Fort\Http\Requests\Frontend;

use Rinvex\Support\Http\Requests\FormRequest;

class UserSettingsUpdateRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Process given request data before validation.
     *
     * @param array $data
     *
     * @return array
     */
    public function process($data)
    {
        if (empty($data['password'])) {
            unset($data['password'], $data['password_confirmation']);
        }

        return array_filter_recursive(array_trim_recursive($data));
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'email'    => 'required|email|max:255|unique:'.config('rinvex.fort.tables.users').',email,'.$this->user()->id,
            'username' => 'required|max:255|unique:'.config('rinvex.fort.tables.users').',username,'.$this->user()->id,
            'phone'    => 'required|numeric|unique:'.config('rinvex.fort.tables.users').',phone,'.$this->user()->id,
            'password' => '<PASSWORD>',
        ];
    }
}
{'fraction_non_alphanumeric': 0.14572234409276089, 'fraction_numerical': 0.004387339392040113, 'mean_word_length': 2.4961664841182913, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 22, 'https://': 2, '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': '5523901', 'n_tokens_mistral': 962, 'n_tokens_neox': 926, 'n_words': 225}