答案 0 :(得分:1)
您可以使用$this->route()->getActionName()
来获取当前操作。即。 MyController @ store,MyController @ rename,MyController @ delete,...
然后在您的SectionRequest中,您可以执行以下操作:
public function rules(){
$arr = explode('@', $this->route()->getActionName());
$method = $arr[1]; // The controller method
switch ($method) {
case 'store':
// do something.
break;
case 'rename':
// do something.
break;
case 'delete':
// .... and so
}
}