--------------------------------------- <SQL> --------------------------------------- SELECT * FROM tbl_work_tables WHERE (staff_id = '1') AND (work_time_start > '10:00' AND work_time_end < '12:00') AND (work_mon = '1' OR work_tue ='1');
When conflict work time, show error in view. Then I wont to show which week day is conflict. It's like this: "[ CONFLICT ! ] Tom cannot work Monday at this time. "
I think It need to return conflict week day from validation. Like: ------------------------------- <Validation> ------------------------------- public static function _validation_conflict_check($val...) {
You can only return a result from a validation rule: - true: validation has passed, validated value is unaltered - false: validation has failed, validated value is unaltered - other value: will replace the validated value and is considered a pass
So no, you can not return a value and fail the validation at the same time. You can have your custom validation rule set a custom message from within the rule:
\Validation::active()->set_message('conflict_check', '[ CONFLICT ! ] Tom cannot work Monday at this time. ');
Note that validation messages are set by rule, not by field, so this doesn't work if you have multiple fields using the same validation rule, and you want to display unique messages.