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

41 行
997B

  1. <?php
  2. namespace App\Http\Controllers\Web\Auth;
  3. use App\Models\User;
  4. use App\Features\LoginUser;
  5. use Illuminate\Support\Arr;
  6. use Illuminate\Support\Facades\Auth;
  7. trait Me
  8. {
  9. use LoginUser;
  10. protected function me()
  11. {
  12. if (Auth::check()) {
  13. $user = Auth::user();
  14. $filteredUser = Arr::only($user->toArray(), [
  15. User::COL_NAME_ID,
  16. User::COL_NAME_CONTRACT_ID,
  17. User::COL_NAME_ROLE,
  18. User::COL_NAME_NAME,
  19. ]);
  20. $contract = $this->loginUser()->getCurrentContract();
  21. if ($contract) {
  22. $filteredUser[User::COL_NAME_CONTRACT_ID] = $contract->id;
  23. $filteredUser['contract_name'] = $contract->name;
  24. $filteredUser['custom'] = $contract->custom();
  25. } else {
  26. $filteredUser[User::COL_NAME_CONTRACT_ID] = null;
  27. }
  28. return $filteredUser;
  29. }
  30. return null;
  31. }
  32. }