How to reduce a Boolean expression in php?

Hello, how to reduce a Boolean expression in php?

if(($objProduct && !$hasCategory) || ($objProduct && $hasCategory && $objCatsRels)){
 return redirect(route('admin.products.edit', ['id' => $objProduct->id]))->with('success', 'Item successfully added');
 }

That is, a redirect will be in two cases:
1) If objProduct == true and has no category
2) Or if objProduct == true there is a category and it was created successfully

Thank you.
March 23rd 20 at 18:55
2 answers
March 23rd 20 at 18:57
Solution
  1. Writable Boolean function.
  2. Finding the minimal DNF / CNF function.
  3. Look, some of the forms easier.
  4. Use.
I think that in this case it is possible to use the usual conversion rules mathematical expressions. In particular the removal of $objProduct the brackets. - monty69 commented on March 23rd 20 at 19:00
March 23rd 20 at 18:59
Solution
if ($objProduct && (!$hasCategory || $objCatsRels)) {}

Find more questions by tags PHP