added login user assign company control

This commit is contained in:
Cüneyt Şentürk
2023-05-10 12:02:27 +03:00
parent 97137ec0bf
commit e6c5047145
2 changed files with 95 additions and 56 deletions

View File

@ -57,7 +57,9 @@ class Users extends Controller
$landing_pages = $u->landing_pages; $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'));
} }
/** /**

View File

@ -160,7 +160,8 @@
</x-table.thead> </x-table.thead>
<x-table.tbody> <x-table.tbody>
@foreach($user->companies as $item) @foreach($companies as $item)
@if (in_array($item->id, user()->company_ids))
<x-table.tr> <x-table.tr>
<x-table.td class="w-2/12 sm:w-1/12"> <x-table.td class="w-2/12 sm:w-1/12">
{{ $item->id }} {{ $item->id }}
@ -219,6 +220,42 @@
</x-slot> </x-slot>
</x-table.td> </x-table.td>
</x-table.tr> </x-table.tr>
@else
<x-table.tr>
<x-table.td class="w-2/12 sm:w-1/12">
***
</x-table.td>
<x-table.td class="w-8/12 sm:w-4/12">
<x-slot name="first" class="flex" override="class">
<div class="font-bold truncate">
***
</div>
</x-slot>
<x-slot name="second">
***
</x-slot>
</x-table.td>
<x-table.td class="w-4/12" hidden-mobile>
<x-slot name="first">
***
</x-slot>
<x-slot name="second">
***
</x-slot>
</x-table.td>
<x-table.td class="w-3/12" kind="amount">
<x-slot name="first">
***
</x-slot>
<x-slot name="second">
***
</x-slot>
</x-table.td>
</x-table.tr>
@endif
@endforeach @endforeach
</x-table.tbody> </x-table.tbody>
</x-table> </x-table>