/** * @return array */ public function scenarios() { $scenarios = parent::scenarios(); $scenarios['create'] = ['number', 'ownerId', 'operatorId', 'destination', 'limit', 'options', 'comment']; $scenarios['update'] = ['ownerId', 'operatorId', 'destination', 'limit', 'options', 'comment']; return $scenarios; }
/** * Returns a list of scenarios and the corresponding active attributes. * An active attribute is one that is subject to validation in the current scenario. * The returned array should be in the following format: * * ~~~ * [ * 'scenario1' => ['attribute11', 'attribute12', ...], * 'scenario2' => ['attribute21', 'attribute22', ...], * ... * ] * ~~~ * * By default, an active attribute is considered safe and can be massively assigned. * If an attribute should NOT be massively assigned (thus considered unsafe), * please prefix the attribute with an exclamation character (e.g. '!rank'). * * The default implementation of this method will return all scenarios found in the [[rules()]] * declaration. Three special scenarios named [[SCENARIO_DEFAULT]], [[SCENARIO_CREATE]] * and [[SCENARIO_UPDATE]] will contain all attributes found in the [[rules()]]. * Each scenario will be associated with the attributes that * are being validated by the validation rules that apply to the scenario. * * @return array a list of scenarios and the corresponding active attributes. */ public function scenarios() { $scenarios = parent::scenarios(); $scenarios[self::SCENARIO_CREATE] = $scenarios[self::SCENARIO_DEFAULT]; $scenarios[self::SCENARIO_UPDATE] = $scenarios[self::SCENARIO_DEFAULT]; return $scenarios; }
public function scenarios() { $scenarios = parent::scenarios(); $scenarios['edit'] = ['mobileNumber', 'employeeName', 'employeePost', 'beginDate', 'endDate', 'rentNumberDate', 'destination']; return $scenarios; }