parfum/app/Traits/Components/WithRoleRedirect.php
Yoga Pangestu bdd793343f fix: update redirect paths and enhance UI layout for order management
- Changed redirect paths in WithRoleRedirect trait from '/login' to '/auth/login' for consistency.
- Adjusted footer layout in home view to include padding for better spacing.
- Improved order management UI by modifying flexbox structure for better responsiveness and alignment of buttons.
2026-01-11 13:14:17 +07:00

33 lines
761 B
PHP

<?php
namespace App\Traits\Components;
use Illuminate\Http\RedirectResponse;
trait WithRoleRedirect
{
public function goToProfile(): RedirectResponse
{
if (! auth()->check()) {
return redirect('/auth/login');
}
$user = auth()->user();
$roles = $user->roles->pluck('name')->toArray();
if (array_intersect($roles, ['Developer', 'Owner', 'Leader', 'Admin'])) {
return redirect('/studio/dashboard/overview');
}
if (in_array('Partner', $roles, true)) {
return redirect('/partner/overview');
}
if (in_array('Customer', $roles, true)) {
return redirect('/member/overview');
}
return redirect('/auth/login');
}
}