Skip to content

Pass variable from controller to $rules #70

Description

@jonaholsson

How would one pass a value from my controller to the model and $rules attribute like below?

protected $rules = [
    ....
    'username' => 'required|unique:users,username,NULL,id,tenant_id,'.$this->tenant_id
];

The following works in the controller, but replaces the entire rules set in the model (and is not as flexible)

$myModel->setRules([
    'username' => required|unique:users,username,NULL,id,tenant_id,'.$this->tenant_id
]);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions