opensupports/server/libs/validations/validAuthorsBlackList.php

20 lines
508 B
PHP
Raw Normal View History

2020-03-02 18:14:29 +01:00
<?php
namespace CustomValidations;
use Respect\Validation\Rules\AbstractRule;
class ValidAuthorsBlackList extends AbstractRule {
2020-03-02 18:14:29 +01:00
public function validate($blackList) {
if(is_array(json_decode($blackList))){
foreach (json_decode($blackList) as $item) {
2020-03-02 21:19:14 +01:00
if(!$item->id || !$item->staff) return false;
if($item->staff != 0 && $item->staff != 1) return false;
2020-03-02 18:14:29 +01:00
if(!is_numeric($item->id)) return false;
}
return true;
}
return false;
}
}