Skip to content

Commit

Permalink
Merge pull request #46 from RasniNathees/customerPageBugs
Browse files Browse the repository at this point in the history
Fix Bug: Unable to Edit Customer from Edit Form
  • Loading branch information
WailanTirajoh authored Aug 1, 2024
2 parents 42104c3 + 09e3cf0 commit 931781f
Show file tree
Hide file tree
Showing 5 changed files with 182 additions and 3 deletions.
11 changes: 11 additions & 0 deletions app/Http/Requests/StoreCustomerRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ public function authorize()
*/
public function rules()
{

if($this->isMethod('put')){
return [
'name' => 'required',
'address' => 'required|max:255',
'job' => 'required',
'birthdate' => 'required|date',
'gender' => 'required|in:Male,Female',
'avatar' => 'mimes:png,jpg',
];
}
return [
'name' => 'required',
'address' => 'required|max:255',
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"pusher/pusher-php-server": "^7.2"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.13",
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.15",
"laravel/sail": "^1.0.1",
Expand Down
154 changes: 153 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions public/hot
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
http://127.0.0.1:5173
18 changes: 16 additions & 2 deletions resources/views/customer/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</div>
<div class="card-body p-3">
<form class="row g-3" method="POST"
action="{{ route('customer.update', ['customer' => $customer->id]) }}">
action="{{ route('customer.update', ['customer' => $customer->id]) }}" enctype="multipart/form-data">
@method('PUT')
@csrf
<div class="col-md-12">
Expand Down Expand Up @@ -42,6 +42,20 @@
</div>
@enderror
</div>
<div class="col-md-12">
<label for="gender" class="form-label">Gender</label>
<select class="form-select @error('gender') is-invalid @enderror" id="gender" name="gender"
aria-label="Default select example">
{{-- <option selected hidden>Select</option> --}}
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
@error('gender')
<div class="text-danger mt-1">
{{ $message }}
</div>
@enderror
</div>
<div class="col-md-12">
<label for="job" class="form-label">Job</label>
<input type="text" class="form-control @error('job') is-invalid @enderror" id="job" name="job"
Expand All @@ -64,7 +78,7 @@
</div>
<div class="col-mg-12">
<label for="avatar" class="form-label">Profile Picture</label>
<input class="form-control" type="file" id="avatar">
<input class="form-control" type="file" id="avatar" name="avatar" >
@error('avatar')
<div class="text-danger mt-1">
{{ $message }}
Expand Down

0 comments on commit 931781f

Please sign in to comment.