Skip to content

Commit

Permalink
pussing profile image update
Browse files Browse the repository at this point in the history
  • Loading branch information
shakilofficial0 committed Dec 17, 2023
1 parent 1a41405 commit fccb257
Show file tree
Hide file tree
Showing 10 changed files with 281 additions and 16 deletions.
22 changes: 19 additions & 3 deletions app/Actions/Fortify/CreateNewUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public function create(array $input)
'state' => ['required', 'string'],
'zip' => ['required', 'string'],
'gender' => ['required', 'string'],
'dob' => ['required', 'string'],
'date_of_birth' => ['required', 'string'],
'country' => ['required', 'string'],
],
[
'username.unique' => 'Username already taken, please try another one',
Expand Down Expand Up @@ -68,7 +69,7 @@ public function create(array $input)
'state.required' => 'State is required',
'zip'=>'State is required',
'gender'=> 'Gender is required',
'dob'=> 'Date of birth is required',
'date_of_birth'=> 'Date of birth is required',

]
)->validate();
Expand All @@ -85,13 +86,28 @@ public function create(array $input)
'created_at' => now(),
'updated_at' => now(),
]);

if($input['gender'] == 'male'){
$profile_image='default_male.png';
} else if($input['gender'] == 'female') {
$profile_image='default_female.png';
} else {
$profile_image='default_others.png';
}
Profile::create([
'user_id' => $user->id,
'created_at' => now(),
'updated_at' => now(),
'address' => $input['address'],
'state' => $input['state'],
'zip' => $input['zip'],
'gender' => $input['gender'],
'profile_image' => $profile_image,
'dob' => $input['date_of_birth'],
'country' => $input['country'],
]);



return $user;
}
}
1 change: 1 addition & 0 deletions app/Models/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Profile extends Model
'dob',
'profile_image',
'status',
'country',
];

protected $table = 'profile';
Expand Down
Binary file added public/assets/img/avatars/default_female.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/img/avatars/default_male.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
255 changes: 249 additions & 6 deletions resources/views/auth/auth-register.blade.php

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<span class="app-brand-logo demo">
<img src="{{ asset('assets/img/logo/solo-coloured.png') }}" alt="Brand Logo" class="img-fluid" />
</span>
<span class="app-brand-text demo menu-text fw-bold">{{config('variables.templateName')}}</span>
<span class="app-brand-text demo menu-text fw-bold" style="max-width: 100px;">{{config('variables.templateName')}}</span>
</a>

<a href="javascript:void(0);" class="layout-menu-toggle menu-link text-large ms-auto">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<!-- Mobile menu toggle: End-->
<a href="javascript:;" class="app-brand-link">
<span class="app-brand-logo demo"><img src="{{ asset('assets/img/logo/solo-coloured.png') }}" alt="Brand Logo" class="img-fluid" /></span>
<span class="app-brand-text demo menu-text fw-bold ms-2 ps-1">{{ config('variables.templateName') }}</span>
<span class="app-brand-text demo menu-text fw-bold ms-2 ps-1" style="max-width: 100px;">{{ config('variables.templateName') }}</span>
</a>
</div>
<!-- Menu logo wrapper: End -->
Expand Down
8 changes: 4 additions & 4 deletions resources/views/layouts/sections/navbar/navbar.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<span class="app-brand-logo demo">
<img src="{{ asset('assets/img/logo/solo-coloured.png') }}" alt="Brand Logo" class="img-fluid" />
</span>
<span class="app-brand-text demo menu-text fw-bold">{{config('variables.templateName')}}</span>
<span class="app-brand-text demo menu-text fw-bold" style="max-width: 100px;">{{config('variables.templateName')}}</span>
</a>
</div>
@endif
Expand Down Expand Up @@ -70,7 +70,7 @@
<li class="nav-item navbar-dropdown dropdown-user dropdown">
<a class="nav-link dropdown-toggle hide-arrow" href="javascript:void(0);" data-bs-toggle="dropdown">
<div class="avatar avatar-online">
<img src="{{ Auth::user() ? Auth::user()->profile_photo_url : asset('assets/img/avatars/1.png') }}" alt class="h-auto rounded-circle">
<img src="{{ asset('assets/img/avatars/') }}/{{Auth::user()->profile->profile_image}}" alt class="h-auto rounded-circle">
</div>
</a>
<ul class="dropdown-menu dropdown-menu-end">
Expand All @@ -79,7 +79,7 @@
<div class="d-flex">
<div class="flex-shrink-0 me-3">
<div class="avatar avatar-online">
<img src="{{ Auth::user() ? Auth::user()->profile_photo_url : asset('assets/img/avatars/1.png') }}" alt class="h-auto rounded-circle">
<img src="{{ asset('assets/img/avatars/') }}/{{Auth::user()->profile->profile_image}}" alt class="h-auto rounded-circle">
</div>
</div>
<div class="flex-grow-1">
Expand All @@ -90,7 +90,7 @@
John Doe
@endif
</span>
<small class="text-muted">Admin</small>
<small class="text-muted">{{ Auth::user()->profile->designation }}</small>
</div>
</div>
</a>
Expand Down
7 changes: 6 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\HawkController;
use App\Http\Controllers\ProfileController;
use Illuminate\Http\Request;
// fortify Routes
@include('fortify.php');
// fortify Routes end
Expand All @@ -21,11 +22,15 @@
return redirect()->route('login');
});

Route::post('/test_post', function (Request $request) {
return json_encode($request->all());
})->name('test_post');

Route::middleware(['auth', 'verified'])->prefix('hawk')->group(function () {
Route::get('home', [HawkController::class, 'index'])->name('hawk.home');
Route::get('profile', [ProfileController::class, 'index'])->name('hawk.profile');
Route::get('test', function(Request $request){
return config('variables.templateName');
return Auth::user();
})->middleware('role:admin');
});

Expand Down

0 comments on commit fccb257

Please sign in to comment.