Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

AccountObserver.php 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. namespace App\Observers;
  3. use App\Models\Banking\Account;
  4. use Illuminate\Support\Facades\Auth;
  5. class AccountObserver
  6. {
  7. /**
  8. * Handle the account "creating" event.
  9. */
  10. public function creating(Account $account): void
  11. {
  12. $account->company()->associate(Auth::user()->currentCompany->id);
  13. $account->company_id = Auth::user()->currentCompany->id;
  14. $account->created_by = Auth::id();
  15. }
  16. /**
  17. * Handle the Account "created" event.
  18. */
  19. public function created(Account $account): void
  20. {
  21. //
  22. }
  23. /**
  24. * Handle the Account "updating" event.
  25. */
  26. public function updating(Account $account): void
  27. {
  28. $account->updated_by = Auth::id();
  29. }
  30. /**
  31. * Handle the Account "updated" event.
  32. */
  33. public function updated(Account $account): void
  34. {
  35. //
  36. }
  37. /**
  38. * Handle the Account "deleted" event.
  39. */
  40. public function deleted(Account $account): void
  41. {
  42. //
  43. }
  44. /**
  45. * Handle the Account "restored" event.
  46. */
  47. public function restored(Account $account): void
  48. {
  49. //
  50. }
  51. /**
  52. * Handle the Account "force deleted" event.
  53. */
  54. public function forceDeleted(Account $account): void
  55. {
  56. //
  57. }
  58. }