julianwayu
julianwayu
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
Anything i add on top of the initial query.. stops my modals from working. even i do it as simple as
public function tasks(): MorphMany
{

return $this->morphMany(Task::class, 'resource')
->orWhere('parent_id', $this->id);
}
public function tasks(): MorphMany
{

return $this->morphMany(Task::class, 'resource')
->orWhere('parent_id', $this->id);
}
It works for pulling the right tasks. but the action buttons do not trigger a modal open
38 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
Was trying to see if I could do it another way but not able to. might have to just use the table with a custom query. and not the relation
38 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
Ok.. its def my relationship:
public function tasks(): MorphMany
{
$releaseId = $this->id;
return $this->morphMany(Task::class, 'resource')
->orWhere(function($subQuery) use($releaseId) {
$subQuery
->where('tasks.parent_type', 'App\\Models\\Release')
->where('tasks.parent_id', $releaseId);
});
}
public function tasks(): MorphMany
{
$releaseId = $this->id;
return $this->morphMany(Task::class, 'resource')
->orWhere(function($subQuery) use($releaseId) {
$subQuery
->where('tasks.parent_type', 'App\\Models\\Release')
->where('tasks.parent_id', $releaseId);
});
}
It does not like my orWhere that bring additional tasks.. if i remove that and just leave it like
public function tasks(): MorphMany
{
return $this->morphMany(Task::class, 'resource');
}
public function tasks(): MorphMany
{
return $this->morphMany(Task::class, 'resource');
}
then it works as expected. no idea why it would cause that though.
38 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
@Kymset i narrow it down. I did it in a regular resource and both conditions work as expected. The problem seems to be in my RalationManager.
38 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
Ugh. What the hell. Ok. Thanks so much for trying out. I’m going to start a new project and try from scratch on something simple. Not clue what’s going on with my current project. Is very bizarre.
38 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
I still think there is some bug or something weird happening with authorize(), hidden() and visible() i have done a bunch of tests. can you do me a huge favor @Kymset can you do the inverse of your test: so instead of ->hidden(fn ($record): bool => $record->id % 2 === 0) do ->hidden(fn ($record): bool => $record->id % 2 != 0) When i do the inverse the modal does not show on the active actions. but if i leave it like you originally did. it works fine and i cant for the life of me figure it out why..
38 replies
FFilament
Created by julianwayu on 7/4/2024 in #❓┊help
CreateAction with form() how to use different model than the current one.
Ok i managed to get the first part working and getting the form to display in the modal by doing this:
Tables\Actions\CreateAction::make('Add Track')
->mountUsing(function (Form $form) {
$form->model = new Models\Track();
})
->form(TrackForm::schema())
->icon('iconoir-plus-circle')
Tables\Actions\CreateAction::make('Add Track')
->mountUsing(function (Form $form) {
$form->model = new Models\Track();
})
->form(TrackForm::schema())
->icon('iconoir-plus-circle')
but now i get the same error when i create the record.
3 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
@Dennis Koch was looking for other ways to accomplish what i want. Quick question, have you guys considered having actions accept a callback? somehting like this:
$table->actions(fn($record): array => $record->actions())
$table->actions(fn($record): array => $record->actions())
This would be really nice, so that instead of relying on hiding stuff via the actions themselves, we can just take care of building the actions and maybe even caching them before hand and would also feel a little more clean or maybe there is already a way to accomplish something similar that I might be missing.
38 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
I give up. it's a mystery. some of my "task types" work some dont. but inspecting the return on the hidden callbacks everything is as expected.
38 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
ok. thanks Dennis for your help. i'm going to keep trying things. will report. need to investigate how the callable inside the hidden works. maybe that can give me some insight to the problem
38 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
No description
38 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
so in theory it should open the modal.
38 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
yeah
38 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
19 is the id
38 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
after i click on the action button.
38 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
thats the response inside of canAction.
38 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
No description
38 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
let me double check all that. not fully sure i understand how to check it. but let me try. lol What's weird is why this works: ->hidden(fn ($record): bool => $record->id % 2 === 0) but not when i moved the same logic to a method inside the record?
38 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
The click button runs. as I can see the requests. when the button is not hidden. but the modal does not appear. The return of the canAction() is as expected since things are getting hidden and showned as expected. the problem is the action button not triggering the modal.
38 replies
FFilament
Created by julianwayu on 6/28/2024 in #❓┊help
Hidden Action and action modal not opening. But if remove hidden the modal works
So.. i moved @Kymset hidden test logic into the canAction in the record.
->hidden(fn ($record): bool => $record->id % 2 === 0)
->hidden(fn ($record): bool => $record->id % 2 === 0)
moved it inside the "record"
public function canAction(): bool
{
return $this->id % 2 === 0;
}
public function canAction(): bool
{
return $this->id % 2 === 0;
}
so the new hidden is like this
->hidden(fn ($record): bool => $record->canAction())
->hidden(fn ($record): bool => $record->canAction())
and same problem occurs.. even though before the hidden() that Kimset suggested to test with worked.
38 replies