PHP Classes

File: example/boolean.php

Recommend this page to a friend!
  Classes of Boss Ibrahim Mussa   Wepesi Validation   example/boolean.php   Download  
File: example/boolean.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Wepesi Validation
Validate a set of values using rule classes
Author: By
Last change:
Date: 1 year ago
Size: 632 bytes
 

Contents

Class file image Download
<?php
/*
 * Copyright (c) 2022. Wepesi validation.
 * @author Boss Ibrahim Mussa
 */
$validate = new \Wepesi\App\Validate();
$schema = new \Wepesi\App\Schema();

$data_source = [
   
'status' => false,
   
'activated' => ""
];
//define the schema model for validation
   
$rules=[
       
"status" => $schema->boolean()->required()->max(true)->isValid('TRUE')->generate(),
       
"activated" => $schema->boolean()->required()->min(false)->isValid('FALSE')->generate(),
    ];

$validate->check($data_source,$rules);
// check if the validation passed or not
   
var_dump($validate->passed());
   
var_dump($validate->errors());