PlanObserver.php 923 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace App\Observers;
  3. use App\Models\Plan;
  4. class PlanObserver
  5. {
  6. /**
  7. * Handle the Plan "created" event.
  8. */
  9. public function created(Plan $plan): void
  10. {
  11. //
  12. }
  13. /**
  14. * Handle the Plan "updated" event.
  15. */
  16. public function updated(Plan $plan): void
  17. {
  18. //
  19. }
  20. /**
  21. * Handle the Plan "deleted" event.
  22. */
  23. public function deleting(Plan $plan): void
  24. {
  25. $plan->requirements()->update(['plan_id' => null]);
  26. $plan->projects()->detach();
  27. }
  28. /**
  29. * Handle the Plan "deleted" event.
  30. */
  31. public function deleted(Plan $plan): void
  32. {
  33. }
  34. /**
  35. * Handle the Plan "restored" event.
  36. */
  37. public function restored(Plan $plan): void
  38. {
  39. //
  40. }
  41. /**
  42. * Handle the Plan "force deleted" event.
  43. */
  44. public function forceDeleted(Plan $plan): void
  45. {
  46. //
  47. }
  48. }