Stormageddon, Dark Lord of All
Stormageddon, Dark Lord of All
Explore posts from servers
FFilament
Created by Stormageddon, Dark Lord of All on 7/4/2024 in #❓┊help
ambiguous column name: id
I couldn't figure out how to change the query on the exporter to change the order by clause, so I removed the normal exportAction entirely and kept only the bulkAction which doesn't attempt to sort the results
5 replies
FFilament
Created by Stormageddon, Dark Lord of All on 6/30/2024 in #❓┊help
Getting weather a field is disabled or not
nevermind, I imported the wrong Component
6 replies
FFilament
Created by Stormageddon, Dark Lord of All on 6/30/2024 in #❓┊help
Getting weather a field is disabled or not
No description
6 replies
FFilament
Created by Stormageddon, Dark Lord of All on 6/30/2024 in #❓┊help
Getting weather a field is disabled or not
for context I need this information to conditionally show a hint explaining why a field is disabled
6 replies
FFilament
Created by Stormageddon, Dark Lord of All on 6/29/2024 in #❓┊help
Best way to handle bulk-attaching models
I figured out a good solution using a custom action, here is the code for future reference:
Action::make('Attach')
->form( [
TagsInput::make('ids')
->label('IDs')
->validationAttribute('IDs')
->required()
->rules([
fn (): Closure => function (string $attribute, $value, Closure $fail) {
$records = User::whereIn('cin', $value)->pluck('cin')->toArray();
$nonExistantIds = array_diff($value, $records);

if(!empty($nonExistantIds)) {
$fail('The following :attribute don\'t exist in the the database: ' . implode(', ',$nonExistantIds));
}
},
])
->splitKeys([' '])
])->action(function (array $data, RelationManager $livewire) {

$ids = User::whereIn('cin', $data['ids'])->pluck('id')->toArray();

$course = Course::find($livewire->ownerRecord->id);

$course->users()->syncWithoutDetaching($ids);

})
Action::make('Attach')
->form( [
TagsInput::make('ids')
->label('IDs')
->validationAttribute('IDs')
->required()
->rules([
fn (): Closure => function (string $attribute, $value, Closure $fail) {
$records = User::whereIn('cin', $value)->pluck('cin')->toArray();
$nonExistantIds = array_diff($value, $records);

if(!empty($nonExistantIds)) {
$fail('The following :attribute don\'t exist in the the database: ' . implode(', ',$nonExistantIds));
}
},
])
->splitKeys([' '])
])->action(function (array $data, RelationManager $livewire) {

$ids = User::whereIn('cin', $data['ids'])->pluck('id')->toArray();

$course = Course::find($livewire->ownerRecord->id);

$course->users()->syncWithoutDetaching($ids);

})
4 replies
FFilament
Created by Stormageddon, Dark Lord of All on 6/28/2024 in #❓┊help
How to download failed rows?
worth noting that I am using an Admin model that has it's own auth guard and not the traditional User model, maybe filament is hard coded to protect the failed-rows route with the user guard/gate
4 replies
FFilament
Created by Stormageddon, Dark Lord of All on 6/26/2024 in #❓┊help
Import Model still trying to use user_id despite specifying a different model
thank you, that documentation fixed it
4 replies
FFilament
Created by Stormageddon, Dark Lord of All on 6/25/2024 in #❓┊help
Manually handling many-to-many relationships
Bumping this up
4 replies
FFilament
Created by Stormageddon, Dark Lord of All on 6/25/2024 in #❓┊help
Manually handling many-to-many relationships
I don't think it is, I don't think filament can figure out how to handle my relationship if simply run ->saveRelationship()
4 replies
FFilament
Created by Stormageddon, Dark Lord of All on 3/24/2024 in #❓┊help
Querying a distant relationship
Bumping this up!
3 replies
FFilament
Created by Stormageddon, Dark Lord of All on 11/29/2023 in #❓┊help
Filament (possibly laravel itself) using wrong mysql syntax
I figured it out as I was answering your question :) I had a is inside my where clause instead of an =. not sure why. thanks!
5 replies
FFilament
Created by Stormageddon, Dark Lord of All on 11/21/2023 in #❓┊help
When to move from different panels to user permissions.
sounds good, thanks for the help
6 replies
FFilament
Created by Stormageddon, Dark Lord of All on 11/21/2023 in #❓┊help
When to move from different panels to user permissions.
the main difference between the invoice resource for admins and regular users is this line:
->modifyQueryUsing(fn (Builder $query) => $query->where('user_id', 'is', Auth::id()))
->modifyQueryUsing(fn (Builder $query) => $query->where('user_id', 'is', Auth::id()))
now that I think about it I could add a condition to apply this only if the logged in user is not an admin, but as the app grows I am sure I'll need to add more roles so this conditional will grow..
6 replies
FFilament
Created by Stormageddon, Dark Lord of All on 11/20/2023 in #❓┊help
Where can I find the main <head> tag in my filamentapp
the solution was to put the directive in it's own blade view then reference that with the view() helper function
8 replies
FFilament
Created by Stormageddon, Dark Lord of All on 11/20/2023 in #❓┊help
Where can I find the main <head> tag in my filamentapp
I'll try to figure this out on my own but if anyone got any idea let me know
8 replies
FFilament
Created by Stormageddon, Dark Lord of All on 11/20/2023 in #❓┊help
Where can I find the main <head> tag in my filamentapp
this outputs @LaravelPwa rather then the value it evaluates to
8 replies
FFilament
Created by Stormageddon, Dark Lord of All on 11/20/2023 in #❓┊help
Where can I find the main <head> tag in my filamentapp
FilamentView::registerRenderHook('panels::head.start', fn (): string => Blade::render('@LaravelPWA'));
FilamentView::registerRenderHook('panels::head.start', fn (): string => Blade::render('@LaravelPWA'));
8 replies
FFilament
Created by Stormageddon, Dark Lord of All on 11/18/2023 in #❓┊help
Make a column smaller (sort of an index)
No description
5 replies
FFilament
Created by Stormageddon, Dark Lord of All on 11/18/2023 in #❓┊help
Make a column smaller (sort of an index)
that didn't seem to work, at least with me having two columns
5 replies