Skip to content

Commit

Permalink
fix edit avatar
Browse files Browse the repository at this point in the history
  • Loading branch information
akechi17 committed Aug 13, 2024
1 parent b66fdbb commit 91f63eb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ public function editProfile()
public function updateProfile(Request $request)
{
$user = auth()->user();
$request->validate([
$this->validate($request, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users,email,' . $user->id,
'gender' => 'nullable|in:male,female',
Expand Down
9 changes: 6 additions & 3 deletions resources/views/students/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{-- @php
dd($students);
dd($students->toArray());
@endphp --}}

@extends('layouts.dashboard')
Expand Down Expand Up @@ -39,7 +39,10 @@

<x-slot:tbody>
@foreach ($students as $student)
@if (count($student->companies()->get()) == 0)
@php
$companies = $student->companies()->get();
@endphp
@if ($companies->isEmpty())
<tr>
<td class="text-center">
<a href="{{ route('presences.index', ['user' => encrypt($student->id)]) }}"
Expand Down Expand Up @@ -85,7 +88,7 @@ class="btn btn-secondary text-xs" style="pointer-events: none" data-bs-toggle="t
<td class="text-sm">{{ $student->internDates()->first()?->extend }}</td>
</tr>
@else
@foreach ($student->companies()->get() as $company)
@foreach ($companies as $company)
@php
$startDate = $student
->internDates()
Expand Down
2 changes: 1 addition & 1 deletion resources/views/users/edit-profile.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

@section('dashboard-content')
<x-form.form formTitle="Edit User" formMethod="POST" spoofMethod="PUT"
formAction="{{ route('users.updateProfile') }}">
formAction="{{ route('users.updateProfile') }}" enctype="multipart/form-data">
<x-slot:formBody>
<x-form.input-base label="Nama *" id="input-name" type="text" name="name" value="{{ $user->name }}" />
<x-form.input-base label="Email *" id="input-email" type="email" name="email" value="{{ $user->email }}" />
Expand Down

0 comments on commit 91f63eb

Please sign in to comment.