Skip to content

Bypass validation on delete #81

Description

@chriscook

Is there is a way to bypass all validation on deletion, without having to specify separate rule sets? Something similar to forceSave()?

Activity

  1. dwightwatson commented on Sep 11, 2014

    @dwightwatson
    Owner

    I like this idea, I'll take a look into it. Unfortunately forceDelete() is already taken by soft deleting though.

    You can still achieve this though, something like:

    $user->setValidating(false);
    $user->delete();
    
  2. chriscook commented on Sep 11, 2014

    @chriscook
    ContributorAuthor

    Ah, I hadn't spotted setValidating(). Thanks- that will help me a lot.

    One idea could be to have an array property on the model to determine which operations to validate on;

    protected $validateOn = [
        'create',
        'update'
    ];
    

    For models without the property, all operations would trigger validation (same as it currently is).

    It could even be beneficial to be able to specify rule sets for each operation:

    protected $validateOn = [
        'create' => 'saving',
        'update' => 'updating'
    ];
    

    (if they're not specified, use the default rule set).

  3. added this to the milestone on Sep 15, 2014
  4. removed this from the milestone on Sep 23, 2014
  5. removed this from the milestone on Sep 23, 2014
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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions