【发布时间】:2022-01-25 00:37:32
【问题描述】:
$myCourseData['points'] = "1";
$myCourseData['totalPoints'] = "2";
$this->update($myCourseData,$myCourseId);
我想将 points 和 totalPoints 从函数传递到函数 update() 并在 update() 中以 $request->points; 访问 points。我该怎么做?只有points & totalPoints 是从上面的函数传递过来的,update() 函数输入中的其他参数是从其他地方获取的。
function update($request,$id){
$validator = Validator::make(
$request->all(),
[
'course_id' => 'nullable|integer',
'exam_numbers' => 'nullable|integer',
'points' => 'nullable|integer',
'subscription' => 'nullable|boolean',
'totalPoints'=>'nullable|integer'
]
);
$points = $request->points;
}
【问题讨论】:
-
你的意思是你想将数据作为请求对象传递?
标签: php laravel validation laravel-8 validationrules