Validate Authentication question tp5

problem description

Call to undefined method appcommonvalidateKlassCourse::validate ()

related codes

Controller
namespace appindexcontroller;
use appcommonmodelCourse;
use appcommonmodelKlass;
use thinkRequest;
use appcommonvalidateKlassCourse;

public function save ()

{
    // 
    $Course = new Course();
    $Course->name = Request::instance()->post("name");

    // 
    if (!$Course->validate(true)->save()) {
        return $this->error(":" . $Course->getError());
    }

    // --------------------------  -------------------------- 
    // klass_id
    $klassIds = Request::instance()->post("klass_id/a");       // /a

    // klass_idklass_idcourse_id
    if (!is_null($klassIds)) {
        $datas = array();
        foreach ($klassIds as $klassId) {
            $data = array();
            $data["klass_id"] = $klassId;
            $data["course_id"] = $Course->id;     // CourseID
            array_push($datas, $data);
        }

        // saveAll()
        if (!empty($datas)) {
            $KlassCourse = new KlassCourse;
            **$result = $KlassCourse->validate(true)->saveAll($datas);**
            if (!$result) {
                return $this->error("-:" . $KlassCourse->getError());
            }
            unset($KlassCourse);    
        }
    }
    // -------------------------- (end) -------------------------- 
    
    unset($Course); 
    return $this->success("", url("index"));
}

validate the model
namespace appcommonvalidate;
use thinkValidate;

class KlassCourse extends Validate
{

protected $rule = [
    "klass_id"  => "require",
    "course_id" => "require"
];

}

Php
Jul.07,2021

visually you are using the ThinkPHP framework, and Validate is a separate validation class, not a model. The model is used for storage and the validation class is used for validation.
continue visual inspection, your model and validation class are renamed, the model does not have a validate method.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e462b1-443d1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e462b1-443d1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?