bwdev1
bwdev1
FFilament
Created by bwdev1 on 12/5/2023 in #❓┊help
Different log-in behaviour depending on user role
Hi, I have two types of users - 'admin' and 'client'. I'd like to use the same log-in page for all users, however if the user is an 'admin', then they should be redirected to the filament dashboard on successful login (url is /admin which i think is the default behaviour of canAccessPanel), while clients should be redirected to their own dashboard (url /dashboard). The current code I have below doesn't work at the moment for clients, but it is a good starting point I believe. The issue with canAccessPanel is that on log in, clients are able to log in but are met with a
public function canAccessPanel(Panel $panel): bool
{
if ($panel->getId() === 'admin') {
if ($this->role == 'admin') {
return true;
}
if ($this->role == 'client') {
return false;
}
}
}
public function canAccessPanel(Panel $panel): bool
{
if ($panel->getId() === 'admin') {
if ($this->role == 'admin') {
return true;
}
if ($this->role == 'client') {
return false;
}
}
}
16 replies
FFilament
Created by bwdev1 on 11/30/2023 in #❓┊help
Managing relationships - creating the ability to navigate to a child element
Hello, currently my data is structured as follows: Project -> (hasmany) Concepts -> (hasmany) Images. I would like to have the ability to click on a Project, which would show off its related Concepts, which then could be clickable which would let the user see that particular Concept and it's associated Images. The first part of this task is easy and I've already done it using https://filamentphp.com/docs/3.x/panels/resources/relation-managers . However, if I click on a Project, I am missing the functionality of being able to view the child entry - or to be more precise, while I do have the ability to 'view', 'edit' and 'delete', the 'view' does not show me the children (Images) of Concept, it just shows me details about that one Concept.
2 replies