您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

TransactionPolicy.php 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace App\Policies;
  3. use App\Models\Accounting\Transaction;
  4. use App\Models\User;
  5. class TransactionPolicy
  6. {
  7. /**
  8. * Determine whether the user can view any models.
  9. */
  10. public function viewAny(User $user): bool
  11. {
  12. return true;
  13. }
  14. /**
  15. * Determine whether the user can view the model.
  16. */
  17. public function view(User $user, Transaction $transaction): bool
  18. {
  19. return true;
  20. }
  21. /**
  22. * Determine whether the user can create models.
  23. */
  24. public function create(User $user): bool
  25. {
  26. return true;
  27. }
  28. /**
  29. * Determine whether the user can update the model.
  30. */
  31. public function update(User $user, Transaction $transaction): bool
  32. {
  33. if ($transaction->transactionable_id) {
  34. return false;
  35. }
  36. return true;
  37. }
  38. /**
  39. * Determine whether the user can delete the model.
  40. */
  41. public function delete(User $user, Transaction $transaction): bool
  42. {
  43. return true;
  44. }
  45. /**
  46. * Determine whether the user can restore the model.
  47. */
  48. public function restore(User $user, Transaction $transaction): bool
  49. {
  50. return true;
  51. }
  52. /**
  53. * Determine whether the user can permanently delete the model.
  54. */
  55. public function forceDelete(User $user, Transaction $transaction): bool
  56. {
  57. return true;
  58. }
  59. }