Delete method inside model policy not working after editing
I tried to disable/hide the delete function when a customer has any comments. It works normally. However, after updating the customer, the delete button appears, which shouldn't be there.
Example Code:
Solution:Jump to solution
I found a workaround for this, inside the delete method policy I added this code:
```php
public function delete(User $user, Customer $customer): bool
{
if ($customer->comments_exists ?? $customer->comments()->exists()) {...
2 Replies
here's the video that showing the bug
Solution
I found a workaround for this, inside the delete method policy I added this code:
Does anyone know why this is happening?