Skip to content

Commit

Permalink
Admins array for creating writers
Browse files Browse the repository at this point in the history
  • Loading branch information
Raccoon254 committed Jun 24, 2024
1 parent 9ada479 commit 07ba535
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/Http/Controllers/Auth/RegisteredUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ public function store(Request $request): RedirectResponse
'password' => Hash::make($request->password),
]);

// Make some users writers
if ($user->email === '[email protected]' || $user->email === 'tomsteve187@gmailcom' || $user->email === '[email protected]') {
$admins_array = ['[email protected]','tomsteve187@gmailcom','[email protected]'];

// Make some users writers if email in the array
if (in_array($request->email, $admins_array)) {
$user->role = 'writer';
$user->save();
}
Expand Down
5 changes: 5 additions & 0 deletions resources/views/livewire/manage-users.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ class="w-10 h-10 ring-1 ring-blue-200 rounded-full">
<td>{{ $user->email }}</td>
<td>{{ $user->role }}</td>
<td class="flex gap-2">
<a href="{{ route('users.show', $user->id) }}">
<button class="custom-btn">
View
</button>
</a>
<a href="{{ route('users.edit', $user->id) }}">
<button class="custom-btn">
Edit
Expand Down
11 changes: 11 additions & 0 deletions resources/views/livewire/user-show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@

<!-- Recent Posts or Orders -->
<div class="w-full max-w-2xl bg-white rounded-lg mt-6 p-6">
<!-- Joined date and last edited and seen -->

<div class="flex justify-between items-center">
<div>
<p class="text-gray-500 text-xs">Joined {{ $user->created_at->diffForHumans() }}</p>
</div>
<div>
<p class="text-gray-500 text-xs">Last seen ... </p>
</div>
</div>

<h2 class="text-lg font-semibold mb-4"> Recent Orders </h2>
@php
$recent_orders = $user->orders->take(3);
Expand Down

0 comments on commit 07ba535

Please sign in to comment.