Php ';方法[validateString]不存在;在拉维验证中

Php ';方法[validateString]不存在;在拉维验证中,php,validation,laravel,Php,Validation,Laravel,我想验证表单输入,但它在我的Laravel.log文件中抛出此错误 production.ERROR:C:\xampp\htdocs\testing\vendor\laravel\framework\src\light\Validation\Validator.php中的异常“BadMethodCallException”和消息“方法[validateString]不存在” 这是我的狗模型 class Dog extends Eloquent { // Add your validation

我想验证表单输入,但它在我的Laravel.log文件中抛出此错误

production.ERROR:C:\xampp\htdocs\testing\vendor\laravel\framework\src\light\Validation\Validator.php中的异常“BadMethodCallException”和消息“方法[validateString]不存在”

这是我的狗模型

class Dog extends Eloquent {

// Add your validation rules here
public static $rules = [
    'name' => 'required|string',
    'age' => 'required|integer'
];

public static $customMessages = array(
    'required' => 'Man the Name atribute is REQUIRED. Fill it man.'
);

// Don't forget to fill this array
protected $fillable = ['name', 'age'];


public static function validate($data) {
    return Validator::make($data, static::$rules);
}
}

在我的狗控制器中,我验证了我的数据

public function update($id)
{

    $dog = $this->DogRepo->find($id);

    if($dog)
    {   
        // $dog = $this->dogRepo->update(array_merge(['id' => $id], Input::all()));

        $validation = Dog::validate(Input::all());

        if ($validation->fails()) {
            return 'wrong data';
        } else {
            return 'ok data';
        }


        if($dog->save())
        {
            return Redirect::route('dogs.show', $id)->with('message', 'The dog has been updated!');
        }

        return Redirect::route('dogs.edit', $id)->withInput()->withErrors($this->dogRepo->errors());
    }

    App::abort(404);

}
知道我做错了什么吗


非常感谢您的帮助。

在Laravel<4.2

没有名为
string
的验证规则

在Laravel>=4.2中有一条字符串规则

更新以反映更新版本的Laravel