Skip to content

Commit

Permalink
Profile photo and avatar fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Raccoon254 committed May 18, 2024
1 parent 20fc4a7 commit cadfbcb
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 7 deletions.
10 changes: 10 additions & 0 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ public function referrals(): HasMany
return $this->hasMany(Referral::class, 'referrer_id');
}

public function getAvatarAttribute(): string
{
return 'https://api.dicebear.com/8.x/identicon/svg?seed=' . $this->name;
}

public function getProfilePhotoAttribute(): string
{
return $this->profile_photo ?? $this->avatar;
}

/**
* The attributes that should be hidden for serialization.
*
Expand Down
45 changes: 40 additions & 5 deletions resources/views/dashboard.blade.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,49 @@
<div class="py-8">
<div class="py-4">
<x-slot name="header">
<h2 class="text-gray-800 leading-tight">
<i class="fas text-blue-500 fa-home"></i>
{{ __('Dashboard') }}
</h2>
</x-slot>
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
<div class="p-6 text-gray-900">
{{ __("You're logged in!") }}
<div class="max-w-7xl relative h-full mx-auto">
<div class="flex sm:mx-3 lg:mx-4 flex-col h-full md:flex-row">
<div class="w-full md:w-2/3 md:pr-2 flex-col">
<div class="top rounded-lg relative p-4 w-full bg-white">
<div>
<span class="text-gray-500 font-semibold">
Hi, {{ explode(' ', auth()->user()->name)[0] }}!
</span>
<div class="text-2xl mt-3 font-semibold text-black/80">
Build your future with <span class="text-blue-500">Scholarspace</span><br>
Place an order today
</div>

<div class="flex mt-3">
<a href="{{ route('orders') }}"
class="bg-blue-500 hover:bg-blue-600 text-white font-semibold py-2 px-4 rounded-md">New Order
</a>
</div>
</div>
<div class="absolute top-8 right-5">
<img src="{{ asset('images/svg2.png') }}" alt="Hero" class="w-64 max-w-md mx-auto rounded-lg">
</div>
</div>
</div>
<div class="md:w-1/3 md:absolute p-4 right-0 -top-8 bg-amber-500">
<div class="center mt-20">
<div class="profile-header">
<div class="center flex-col">
<div class="avatar">
<div class="w-24 rounded-full ring ring-primary ring-offset-base-100 ring-offset-2">
<img src="https://img.daisyui.com/images/stock/photo-1534528741775-53994a69daeb.jpg" />
</div>
</div>
<div class="profile-header-info">
<h4 class="mt-3 text-white">{{ auth()->user()->name }}</h4>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<div class="flex relative gap-2 p-2">
@include('layouts.sidebar')
<!-- Page Content -->
<main class="w-full bg-gray-100 rounded-lg">
<main class="w-full bg-gray-100 overflow-clip rounded-[16px]">
{{ $slot }}
</main>
</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/layouts/navigation.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</div>
<a href="#" class="h-8 w-8 ml-2 avatar rounded-full p-[2px] ring-1">
<img class="h-8 w-8 ring-1 ring-white rounded-full"
src="https://api.dicebear.com/8.x/identicon/svg?seed=Jane" alt="John Doe">
src="{{ auth()->user()->profile_photo }}" alt="{{ auth()->user()->name }}"/>
</a>
</div>
</div>

0 comments on commit cadfbcb

Please sign in to comment.