Save workspace changes
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Controllers\Web;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\View\View;
|
||||
|
||||
/**
|
||||
* StaffController — /staff
|
||||
*
|
||||
* Displays all users with an elevated role (admin, moderator) grouped by role.
|
||||
*/
|
||||
final class StaffController extends Controller
|
||||
{
|
||||
/** Roles that appear on the staff page, in display order. */
|
||||
private const STAFF_ROLES = ['admin', 'moderator'];
|
||||
|
||||
public function index(): View
|
||||
{
|
||||
/** @var Collection<string, \Illuminate\Support\Collection<int, User>> $staffByRole */
|
||||
$staffByRole = User::with('profile')
|
||||
->whereIn('role', self::STAFF_ROLES)
|
||||
->where('is_active', true)
|
||||
->orderByRaw("CASE role WHEN 'admin' THEN 0 WHEN 'moderator' THEN 1 ELSE 2 END")
|
||||
->orderBy('username')
|
||||
->get()
|
||||
->groupBy('role');
|
||||
|
||||
return view('web.staff', [
|
||||
'page_title' => 'Staff — Skinbase',
|
||||
'page_meta_description' => 'Meet the Skinbase team — admins and moderators who keep the community running.',
|
||||
'page_canonical' => url('/staff'),
|
||||
'hero_title' => 'Meet the Staff',
|
||||
'hero_description' => 'The people behind Skinbase who keep the community running smoothly.',
|
||||
'breadcrumbs' => collect([
|
||||
(object) ['name' => 'Home', 'url' => '/'],
|
||||
(object) ['name' => 'Staff', 'url' => '/staff'],
|
||||
]),
|
||||
'staffByRole' => $staffByRole,
|
||||
'roleLabels' => [
|
||||
'admin' => 'Administrators',
|
||||
'moderator' => 'Moderators',
|
||||
],
|
||||
'center_content' => true,
|
||||
'center_max' => '3xl',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user