zemo
zemo
FFilament
Created by zemo on 9/24/2024 in #❓┊help
What is the best way to conditionally hide a tab in the ListResource page?
oh thanks :)) I'm going to stick with my approach then
17 replies
FFilament
Created by zemo on 9/24/2024 in #❓┊help
What is the best way to conditionally hide a tab in the ListResource page?
oh wow I didn't think that'd work, thanks!!
17 replies
FFilament
Created by zemo on 9/24/2024 in #❓┊help
What is the best way to conditionally hide a tab in the ListResource page?
how can I create a table filter based on a condition (you guessed it, the condition is the same lol)?
17 replies
FFilament
Created by zemo on 9/24/2024 in #❓┊help
What is the best way to conditionally hide a tab in the ListResource page?
done this, thanks ❤️
17 replies
FFilament
Created by zemo on 9/24/2024 in #❓┊help
What is the best way to conditionally hide a tab in the ListResource page?
on a similar note, I would like to have a filter pre-selected and disabled on a resource, depending on the user role. I know I can use default() on a SelectFilter. the issue is that the user can just remove the filter by clicking on the "x". I thought about using disabled() but it does not exist on SelectFilter. I thought about just modifying the resource query based on the fact that you have a role or not. any more insights? or a way to disable the filter. Thank you
17 replies
FFilament
Created by zemo on 9/24/2024 in #❓┊help
What is the best way to conditionally hide a tab in the ListResource page?
thank you! should I use your approach or mine, or both are equally ok? what I've done is simply create the tabs based on the fact that you have a role or not. example:
if($user->hasRole('Admin')) {
$tabs = ['all' => Tab::make('Tutti')
->badge($this->getModel()::count())
];
}
if($user->hasRole('Admin')) {
$tabs = ['all' => Tab::make('Tutti')
->badge($this->getModel()::count())
];
}
17 replies
FFilament
Created by zemo on 9/24/2024 in #❓┊help
What is the best way to conditionally hide a tab in the ListResource page?
In the meanwhile, I've resorted to creating the tab conditionally or not, but I'll wait in case there is a better approach.
17 replies
FFilament
Created by zemo on 9/24/2024 in #❓┊help
What is the best way to conditionally hide a tab in the ListResource page?
I had already tried that with ->hidden() Method Filament\Resources\Components\Tab::visible does not exist.
17 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
though, I just did this and it appears to do what I'm trying to do. might stick with it at this point
->createOptionUsing(function (array $data) {
$subscription = Subscription::where('subject_id', $data['subject_id'])->where('subscription_year_id', $data['subscription_year_id'])->first();

if ($subscription) {
return;
}

$subscription = new Subscription();
$subscription->subject_id = $data['subject_id'];
$subscription->subscription_year_id = $data['subscription_year_id'];
$subscription->federation_id = $data['federation_id'];
$subscription->date = $data['date'];
$subscription->price = $data['price'];
$subscription->save();
return $subscription->id;
})
->createOptionUsing(function (array $data) {
$subscription = Subscription::where('subject_id', $data['subject_id'])->where('subscription_year_id', $data['subscription_year_id'])->first();

if ($subscription) {
return;
}

$subscription = new Subscription();
$subscription->subject_id = $data['subject_id'];
$subscription->subscription_year_id = $data['subscription_year_id'];
$subscription->federation_id = $data['federation_id'];
$subscription->date = $data['date'];
$subscription->price = $data['price'];
$subscription->save();
return $subscription->id;
})
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
$validator = Validator::make($data, [
Rule::unique('subscriptions')->where(function ($query) use($data) {
ray('prova');
return $query->where('subject_id', $data['subject_id'])
->where('subscription_year_id', $data['subscription_year_id']);
}),
]);
if ($validator->fails()) {
ray('ciao');
return null;
}
$validator = Validator::make($data, [
Rule::unique('subscriptions')->where(function ($query) use($data) {
ray('prova');
return $query->where('subject_id', $data['subject_id'])
->where('subscription_year_id', $data['subscription_year_id']);
}),
]);
if ($validator->fails()) {
ray('ciao');
return null;
}
even this was not working
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
like the one I was trying to do (which is commented)? in the createOptionUsing
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
so perhaps it does not know which table to check for the unique validation rule?
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
Forms\Components\Select::make('subscription_id') doesn't have a relationship()
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
ahhh maybe I found a logic reason as to why it is not working
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
cos if they fired I would've known that the issue had to do with the fn
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
the very strange thing is that the dd() or the ray() are not firing..
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
did both, not working
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
v3.2.96
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
I hope this is fine as well
32 replies
FFilament
Created by zemo on 9/17/2024 in #❓┊help
if I use createOptionUsing (along with createOptionForm), do I have to validate the inputs manually?
32 replies