Commit eae6b80f5e37e6189f28730d708fd22e457ae9b1

Authored by Андрей Ларионов
1 parent 50aa60b601

Работодатель лого

Showing 3 changed files with 10 additions and 8 deletions Side-by-side Diff

app/Http/Controllers/Admin/EmployersController.php
... ... @@ -25,7 +25,8 @@ class EmployersController extends Controller
25 25 $user->update($request->all());
26 26 }
27 27  
28   - $users = User::with('employers')->select(['users.*','users.id as usr_id', 'emp.id as emp_id', 'emp.*'])->join('employers as emp','emp.user_id','users.id')
  28 + $users = User::with('employers')->select(['users.*','users.id as usr_id', 'emp.id as emp_id', 'emp.logo as emp_logo', 'emp.*'])
  29 + ->join('employers as emp','emp.user_id','users.id')
29 30 ->where('users.is_worker', '0')->Realuser();
30 31 $all_employer = $users->count();
31 32  
resources/views/admin/employer/edit.blade.php
... ... @@ -92,9 +92,9 @@
92 92 <img src="<?=asset(Storage::url($employer->logo))?>" width="150"/>
93 93 @endisset
94 94 @error('logo')
95   - <span class="text-xs text-red-600 dark:text-red-400">
96   - {{ $message }}
97   - </span>
  95 + <span class="text-xs text-red-600 dark:text-red-400">
  96 + {{ $message }}
  97 + </span>
98 98 @enderror
99 99 </label><br>
100 100  
resources/views/admin/employer/index.blade.php
... ... @@ -41,7 +41,7 @@
41 41 btns.forEach(btn => {
42 42 btn.addEventListener('click', (e) => {
43 43 console.log('click button');
44   - const id = e.target.id;
  44 + let id = e.target.id;
45 45 let form = document.getElementById("form_modal_del");
46 46 form.action = "<?=$_SERVER['HTTP_REFERER']?>/delete/"+e.target.getAttribute('data-employer')+'/'+e.target.getAttribute('data-user');
47 47 //document.getElementById("title_modal").innerHTML = id;
... ... @@ -112,8 +112,9 @@
112 112 {{$user->name}}
113 113 </td>
114 114 <td class="px-4 py-3">
115   - @if (isset($user->employers[0]->logo) && ($user->employers[0]->logo))
116   - <img src="{{ asset(Storage::url($user->employers[0]->logo)) }}" style="width:50px"/>
  115 +
  116 + @if (isset($user->emp_logo) && ($user->emp_logo))
  117 + <img src="{{ asset(Storage::url($user->emp_logo)) }}" style="width:50px"/>
117 118 @else
118 119 -
119 120 @endif
... ... @@ -141,7 +142,7 @@
141 142 <td class="px-4 py-3 text-sm">
142 143 @if (!empty($user->comment_admin))
143 144  
144   - <a style="text-decoration: underline;" href="{{ route('admin.comment-employer', ['employer' => $user->id]) }}">Есть</a>
  145 + <a style="text-decoration: underline;" href="{{ route('admin.comment-employer', ['employer' => $user->emp_id]) }}">Есть</a>
145 146 @else
146 147 Нет
147 148 @endif