martinsbalodis / validator-laravel by martinsbalodis

Base validation service class
11
1
2
Package Data
Maintainer Username: martinsbalodis
Maintainer Contact: martins256@gmail.com (Martins Balodis)
Package Create Date: 2015-01-29
Package Last Update: 2015-01-30
Language: PHP
License: MIT
Last Refreshed: 2024-05-18 15:20:31
Package Statistics
Total Downloads: 11
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 1
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Usage

<?php
namespace App\Lib\Validators;

class MyValidator extends Validator {

	public static $rules = array(
		'title' => 'required',
		'description' => 'required',
	);
}

$input = array(
    'title' => 'asd',
    'description' => 'dsa',
);
$validator = new MyValidator($input);
if(!$validator->fails()) {
    // passes
}
else {
    $validator->messages();
}