Patrick
auth()->user() is NULL for loading custom assets with data
Sry I don't get it...I tried custom ServiceProvider, however it does not work.
In the docs they write
"Sometimes, you may wish to make data from the backend available to JavaScript files. To do this, you can use the FilamentAsset::registerScriptData() method in the boot() method of a service provider:"
the best place for my script would be in my AdminPanelProvider boot method. So how can I ensure it only runs after middleware?
13 replies
How can I hide NaviationItems in custom NavigationGroup based on user role
Okay...sorry it's not working with new login. I found the solution here: https://github.com/filamentphp/filament/issues/7288
11 replies
How can I hide NaviationItems in custom NavigationGroup based on user role
Mhh but I am using a custom navigation, so ->navigationItems is not what I am using or?
I am using your build in :getNavigationItems() on a resource which neither accepts a closure nor I have access to visible() or hide()
Custom Nav code part. So for example for Order Management I can hide the whole nav group by returning empty array if my auth check fails. But no clue how I can do it for single getNavigationItems()
11 replies
How can I hide NaviationItems in custom NavigationGroup based on user role
@Dennis Koch Thanks for your fast reply, I added a closure but the problem is more that visible() is not available on getNavigationItems(). Any ideas if there is way to solve it except adding all pages manually?
11 replies
How to apply current filters to Columns using summaries?
Solution was provided by Kenneth Sese
TextColumn::make('order_items_sum')
->sum(fn ($livewire) => ['orderItems' => function ($query) use ($livewire) {
// dump the tableFilters to see the array structure so you can get the value. Probably want to use data_get() with wildcards)
dd($livewire->tableFilters);
return $query->where('your_table_filter', 'your_value');
}]),
3 replies
Repeater Items: Disable already added items after form saved in edit mode
Sorry guys I think I did not explained my issue well.
And the title was misleading.
I have a RelationManager in my Tenant view for Orders. In Order Modal I can add OrderItems. What I was looking for is that already added items are disabled (only deletable) in Edit mode.
9 replies
Is it possible to make select input invisible but send the default value with the form submit ?
Hi, do you have an example what you try to do? Why do u want to use a Select instead of Hidden or other Field with visible() and dehydrated() ?
7 replies
Repeater Items: Disable already added items after form saved in edit mode
Hey @Rotorbit69 , Thanks for your reply. This is sadly not working for my case, what I did now is to wrap all fields in a grid and disabled() the grid based on the created_at hidden field.
9 replies
Trigger form + relationship save method in custom action?
Thanks for your replies and help!
It worked with $form->saveRelationships() in my custom action. I was missing to use($form) in my custom action and so had no access to saveRelationships()
Thanks 🙂
4 replies
Relations..
Perhaps sth like:
class ProductResource extends Resource
{
// ...
protected static function form(Form $form): Form
{
return $form
->schema([
RichEditor::make('info')
->label('Product Info')
->required()
->reactive()
->afterStateUpdated(fn ($state, callable $set) => $set('productInfo.info', $state)), //<- info equals the field where you want to save the information
]);
}
// ...
Then in your CreateProduct / EditProduct page you could use sth like:
public static function mutateFormDataBeforeSave(array $data): array
{
if (isset($data['info'])) {
$data['productInfo']['info'] = $data['info'];
unset($data['info']);
}
return $data;
}
public static function mutateFormDataBeforeFill(array $data): array
{
if (isset($data['productInfo']['info'])) {
$data['info'] = $data['productInfo']['info'];
}
return $data;
}
// ...
}
11 replies