0

I have category table Its has del_status

when delete category delstatus will change 1

now question is when update category , I want to validate except del_status 0

because category is unique

eg below is pseudo code :)

Rule::except(function ($query){
    return $query->where('del_status','1');
})

1 Answer 1

2

You should use The softDelete traits in your model. it will spare you a lot of trouble and will work as you want it to.

https://laravel.com/docs/5.7/eloquent#soft-deleting

it will use a field in the DB table name deleted_at

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks you sir Can i customize the rule like my question .please answer me if you have any idea
you wont have to. a category with deleted_at different from null will not be considered just as if it was "deleted"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.