- 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.
33 lines
761 B
PHP
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');
|
|
}
|
|
}
|