<commit_before><?php namespace App;

use Illuminate\Database\Eloquent\Model;
use Validator;

class Category extends Model {


	protected $fillable = ['name'];

	private static $messages = [
		// name messages
		'name.required' => 'El nombre es requerido',
		'name.alpha' => 'El nombre no puede contener números ni símbolos',
		'name.max' => 'El nombre debe tener menos de :max caracteres',
		'name.min' => 'El nombre debe tener al menos :min caracteres',
	];

	private static $rulesForCreation = [
			'name' => 'required|alpha|min:4|max:50|unique:categories,name'
	];

	public static function validate($all) {
		$rules = self::$rulesForCreation;
		$messages = self::$messages;

		return Validator::make($all, $rules, $messages);
	}

	public static function validateUpdate($all) {
		$rulestemp = self::$rulesForCreation;
		$messages = self::$messages;

		$rulestemp['name'] = 'required|alpha|min:4|max:50|unique:categories,name,'.$all['id'];

		return Validator::make($all, $rulestemp, $messages);
	}

	//
	public function articles() {
		return $this->hasMany('App\Article');
	}
}<commit_msg>Fix validation messages in category<commit_after><?php namespace App;

use Illuminate\Database\Eloquent\Model;
use Validator;

class Category extends Model {


	protected $fillable = ['name'];

	private static $messages = [
		// name messages
		'name.required' => 'El nombre es requerido',
		'name.unique' => 'Ya existe una categoría con ese nombre',
		'name.alpha' => 'El nombre no puede contener números ni símbolos',
		'name.max' => 'El nombre debe tener menos de :max caracteres',
		'name.min' => 'El nombre debe tener al menos :min caracteres',
	];

	private static $rulesForCreation = [
			'name' => 'required|alpha|min:4|max:50|unique:categories,name'
	];

	public static function validate($all) {
		$rules = self::$rulesForCreation;
		$messages = self::$messages;

		return Validator::make($all, $rules, $messages);
	}

	public static function validateUpdate($all) {
		$rulestemp = self::$rulesForCreation;
		$messages = self::$messages;

		$rulestemp['name'] = $rulestemp['name'].','.$all['id'];

		return Validator::make($all, $rulestemp, $messages);
	}

	//
	public function articles() {
		return $this->hasMany('App\Article');
	}
}
{'fraction_non_alphanumeric': 0.1575649059982095, 'fraction_numerical': 0.0040286481647269475, 'mean_word_length': 4.912698412698413, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, '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': '1835800', 'n_tokens_mistral': 778, 'n_tokens_neox': 732, 'n_words': 186}