add role permission logic
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Roles;
|
||||
|
||||
use App\Models\Role;
|
||||
|
||||
class RoleDashboardService
|
||||
{
|
||||
/** @param string[] $roleKeys */
|
||||
public function bestDashboardRouteFor(array $roleKeys): string
|
||||
{
|
||||
$rows = Role::findByNamesOrSlugs($roleKeys);
|
||||
if (!empty($rows)) {
|
||||
return $rows[0]->dashboard_route ?? '/landing_page/guest_dashboard';
|
||||
}
|
||||
|
||||
return '/landing_page/guest_dashboard';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user