From e6c50471459824584aeb331923ea9e85ba722f06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Wed, 10 May 2023 12:02:27 +0300 Subject: [PATCH] added login user assign company control --- app/Http/Controllers/Auth/Users.php | 4 +- resources/views/auth/users/show.blade.php | 147 ++++++++++++++-------- 2 files changed, 95 insertions(+), 56 deletions(-) diff --git a/app/Http/Controllers/Auth/Users.php b/app/Http/Controllers/Auth/Users.php index fa381c9cb..b11328c4d 100644 --- a/app/Http/Controllers/Auth/Users.php +++ b/app/Http/Controllers/Auth/Users.php @@ -57,7 +57,9 @@ class Users extends Controller $landing_pages = $u->landing_pages; - return view('auth.users.show', compact('user', 'landing_pages')); + $companies = $user->companies()->collect(); + + return view('auth.users.show', compact('user', 'landing_pages', 'companies')); } /** diff --git a/resources/views/auth/users/show.blade.php b/resources/views/auth/users/show.blade.php index 529317f36..655ec66f8 100644 --- a/resources/views/auth/users/show.blade.php +++ b/resources/views/auth/users/show.blade.php @@ -160,65 +160,102 @@ - @foreach($user->companies as $item) - - - {{ $item->id }} - + @foreach($companies as $item) + @if (in_array($item->id, user()->company_ids)) + + + {{ $item->id }} + - - -
- {{ $item->name }} -
+ + +
+ {{ $item->name }} +
- @if (! $item->enabled) - - @endif -
- - @if ($item->tax_number) - {{ $item->tax_number }} - @else - - @endif - -
+ @if (! $item->enabled) + + @endif +
+ + @if ($item->tax_number) + {{ $item->tax_number }} + @else + + @endif + +
- - - @if ($item->email) - {{ $item->email }} - @else - - @endif - - - @if ($item->phone) - {{ $item->phone }} - @else - - @endif - - + + + @if ($item->email) + {{ $item->email }} + @else + + @endif + + + @if ($item->phone) + {{ $item->phone }} + @else + + @endif + + - - - @if ($item->country) - - @else - - @endif - - - @if ($item->currency) - - @else - - @endif - - -
+ + + @if ($item->country) + + @else + + @endif + + + @if ($item->currency) + + @else + + @endif + + +
+ @else + + + *** + + + + +
+ *** +
+
+ + *** + +
+ + + + *** + + + *** + + + + + + *** + + + *** + + +
+ @endif @endforeach