update pengguna tkr hasone semula

This commit is contained in:
Nur Izzati Zulkifli
2022-11-15 14:36:15 +08:00
parent 6353fce47d
commit f3c58e3034
4 changed files with 14 additions and 11 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ class User extends Authenticatable
public function cawangan()
{
return $this->hasMany(Cawangan::class, 'caw_code' , 'kodcaw');
return $this->hasOne(Cawangan::class, 'caw_code' , 'kodcaw');
}
}
+3 -3
View File
@@ -51,9 +51,9 @@
<td>{{$key+1}}</td>
<td align="left">{{ $value->name }}</td>
<td>{{ $value->email }}</td>
<td style='white-space:nowrap;'> @foreach ($value->cawangan as $cawuser)
{{$cawuser->caw_name}}
@endforeach</td>
<td style='white-space:nowrap;'> @if($value->cawangan != NULL)
{{$value->cawangan->caw_name}}
@endif</td>
</td>
<td>
@foreach ($value->roles as $taraf)
@@ -49,10 +49,11 @@
<td style='white-space:nowrap;'>{{ $user->name }}</td>
<td>{{ $user->username }}</td>
<td>{{ $user->email }}</td>
<td style='white-space:nowrap;'> @foreach ($user->cawangan as $cawuser)
{{$cawuser->caw_name}}
@endforeach</td>
<td style='white-space:nowrap;'>
@if($user->cawangan != NULL)
{{$user->cawangan->caw_name}}
@endif
</td>
<td>
@foreach ($user->roles as $taraf)
<button class="btn btn-primary btn-sm hovernone" disabled>{{$taraf->name}}</button><br>
@@ -26,9 +26,11 @@
<label for="name">Cawangan</label>
<select class="custom-select" name="caw" id="caw" required>
<option disabled>Pilih Cawangan</option>
<option selected value="{{$user->kodcaw}}"> @foreach ($user->cawangan as $cawuser)
{{$cawuser->caw_name}} @endforeach</option>
<option selected value="">-</option>
@if($user->cawangan != NULL)
<option selected value="{{$user->kodcaw}}">
{{$user->cawangan->caw_name}}
</option> @endif
@foreach ($caw as $item)
<option value="{{$item->caw_code}}">{{$item->caw_name}}</option>
@endforeach