Skip to content

Commit bab3f09

Browse files
Finish whole users page
1 parent 599e6ab commit bab3f09

File tree

3 files changed

+51
-2
lines changed

3 files changed

+51
-2
lines changed

app/Http/Controllers/UserController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ public function store(UserStoreRequest $request)
4444
*/
4545
public function show(string $id)
4646
{
47-
//
47+
$getUser = User::findOrFail($id);
48+
49+
return Inertia::render('Users/Show', compact('getUser'));
4850
}
4951

5052
/**

resources/js/Components/Breadcrumb.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<h2 class="font-semibold text-xl text-gray-800 leading-tight">
33
<inertia-link class="hover:text-blue-500 duration-200" :href="`/${href}`">{{ title }}</inertia-link>
44
/
5-
<inertia-link :href="`/${href}/${property.id}/edit`" class="text-blue-500">
5+
<inertia-link :href="`/${href}/${property.id}`" class="text-blue-500">
66
{{ property.name }}
77
</inertia-link>
88
</h2>

resources/js/Pages/Users/Show.vue

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<template>
2+
<AppLayout title="User profile">
3+
<div class="flex flex-col items-center justify-center min-h-screen bg-gray-100">
4+
<div class="max-w-lg w-full bg-white shadow-lg rounded-lg overflow-hidden">
5+
<img class="w-full h-64 object-cover" :src="user.coverImage" alt="User cover image">
6+
<div class="p-4">
7+
<img class="h-24 w-24 rounded-full mx-auto mb-4" :src="user.profileImage" alt="User profile image">
8+
<h1 class="text-2xl font-bold text-center">{{ getUser.name }}</h1>
9+
<center>
10+
<a :href="'mailto:' + getUser.email" class="text-gray-600 text-center">{{ getUser.email }}</a>
11+
</center>
12+
<hr class="my-4">
13+
<div class="my-2">
14+
<h2 class="text-gray-600 text-sm font-bold uppercase">About</h2>
15+
<p class="mt-2 text-gray-600">{{ user.about }}</p>
16+
</div>
17+
</div>
18+
</div>
19+
</div>
20+
</AppLayout>
21+
</template>
22+
23+
<script>
24+
import AppLayout from '@/Layouts/AppLayout.vue';
25+
26+
export default {
27+
components: {
28+
AppLayout
29+
},
30+
props: {
31+
getUser: Object
32+
},
33+
data() {
34+
return {
35+
user: {}
36+
}
37+
},
38+
mounted() {
39+
this.user = Object.assign(this.user, {
40+
profileImage: 'https://randomuser.me/api/portraits/men/10.jpg',
41+
coverImage: 'https://www.itnewsafrica.com/wp-content/uploads/2022/07/Software-Devs.jpg',
42+
about: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla at dictum est. Sed id lacus ut ipsum semper lobortis vel non metus. Duis sit amet orci metus. Suspendisse at leo est. Nullam tincidunt, tellus sed vestibulum scelerisque, nisl mauris varius mauris, in scelerisque mi orci eget tortor.',
43+
});
44+
this.$forceUpdate();
45+
}
46+
}
47+
</script>

0 commit comments

Comments
 (0)