__Dementor
__Dementor
FFilament
Created by __Dementor on 6/9/2024 in #❓┊help
Repeater have problem
I have it shared, but privately. Is it a problem if you gave me your email address?
28 replies
FFilament
Created by __Dementor on 6/9/2024 in #❓┊help
Repeater have problem
Github or only this resource and models?
28 replies
FFilament
Created by __Dementor on 6/9/2024 in #❓┊help
Repeater have problem
Still not working
28 replies
FFilament
Created by __Dementor on 6/9/2024 in #❓┊help
Repeater have problem
I understand that ->whereDepotId() is a scope?
28 replies
FFilament
Created by __Dementor on 6/9/2024 in #❓┊help
Repeater have problem
No description
28 replies
FFilament
Created by __Dementor on 6/9/2024 in #❓┊help
Repeater have problem
No description
28 replies
FFilament
Created by __Dementor on 6/9/2024 in #❓┊help
Repeater have problem
I remove ->reactive() and this still not working
28 replies
FFilament
Created by __Dementor on 6/9/2024 in #❓┊help
Repeater have problem
Tabs\Tab::make('Depot')
->schema([
Forms\Components\Select::make('depot_id')
->options(Depot::query()->pluck('name', 'id'))
->required()
->live()
->reactive(),
]),
Tabs\Tab::make('Depot')
->schema([
Forms\Components\Select::make('depot_id')
->options(Depot::query()->pluck('name', 'id'))
->required()
->live()
->reactive(),
]),
28 replies
FFilament
Created by __Dementor on 6/9/2024 in #❓┊help
Repeater have problem
This
->options(function (Forms\Get $get) {
return Product::query()
->where('depot_id', $get('depot_id'))
->pluck('name', 'id');
})
->options(function (Forms\Get $get) {
return Product::query()
->where('depot_id', $get('depot_id'))
->pluck('name', 'id');
})
Doesn't work. Without where() works, with where doesnt work 😦
28 replies
FFilament
Created by __Dementor on 6/9/2024 in #❓┊help
Repeater have problem
Whats wrong?
Forms\Components\Repeater::make('Select products')
->relationship('items')
->required()
->live()
->schema([
Forms\Components\Select::make('product_id')
->label(__('depot_deliveries.create.product_id'))
->options(function (Forms\Get $get) {
return Product::query()
->where('depot_id', $get('depot_id'))
->pluck('name', 'id');
})
->distinct()
->disableOptionsWhenSelectedInSiblingRepeaterItems()
->reactive()
->live()
->afterStateUpdated(function ($state, Forms\Set $set) {
$set('system_quantity', Product::query()->find($state)?->quantity ?? 0);
$set('price', Product::query()->find($state)?->price ?? 0);
})
->searchable()
->columnSpanFull()
->required(),


])
->columns(2),
Forms\Components\Repeater::make('Select products')
->relationship('items')
->required()
->live()
->schema([
Forms\Components\Select::make('product_id')
->label(__('depot_deliveries.create.product_id'))
->options(function (Forms\Get $get) {
return Product::query()
->where('depot_id', $get('depot_id'))
->pluck('name', 'id');
})
->distinct()
->disableOptionsWhenSelectedInSiblingRepeaterItems()
->reactive()
->live()
->afterStateUpdated(function ($state, Forms\Set $set) {
$set('system_quantity', Product::query()->find($state)?->quantity ?? 0);
$set('price', Product::query()->find($state)?->price ?? 0);
})
->searchable()
->columnSpanFull()
->required(),


])
->columns(2),
28 replies
FFilament
Created by __Dementor on 6/9/2024 in #❓┊help
Repeater have problem
Thanks bro ❤️
28 replies
FFilament
Created by __Dementor on 6/9/2024 in #❓┊help
Repeater have problem
That was too easy
28 replies
FFilament
Created by __Dementor on 6/9/2024 in #❓┊help
Repeater have problem
Omg
28 replies
FFilament
Created by __Dementor on 6/9/2024 in #❓┊help
Repeater have problem
No description
28 replies
FFilament
Created by __Dementor on 6/9/2024 in #❓┊help
Repeater have problem
And mutate data
protected function mutateFormDataBeforeCreate(array $data): array {

if(!empty($data['products'])) {
$products = $data['products'];

foreach ($products as $product) {
$dataToInsert = [
'delivery_id' => 1,
'price' => $product['price'],
'quantity' => $product['quantity'],
'product_id' => $product['product_id']
];

DeliveryProduct::query()
->insert($dataToInsert);
}

$data['products'] = null;
}

return $data;
}
protected function mutateFormDataBeforeCreate(array $data): array {

if(!empty($data['products'])) {
$products = $data['products'];

foreach ($products as $product) {
$dataToInsert = [
'delivery_id' => 1,
'price' => $product['price'],
'quantity' => $product['quantity'],
'product_id' => $product['product_id']
];

DeliveryProduct::query()
->insert($dataToInsert);
}

$data['products'] = null;
}

return $data;
}
28 replies
FFilament
Created by __Dementor on 3/19/2024 in #❓┊help
Move items in menu
But what about the first config and jobs? Jobs have no configuration at all.
7 replies
FFilament
Created by __Dementor on 3/19/2024 in #❓┊help
Move items in menu
I have a config for exceptions
return [
'icons' => [
'navigation' => 'heroicon-o-exclamation-triangle',
'exception' => 'heroicon-o-exclamation-triangle',
'headers' => 'heroicon-o-arrows-right-left',
'cookies' => 'heroicon-o-circle-stack',
'body' => 'heroicon-s-code-bracket',
'queries' => 'heroicon-s-circle-stack',
],
];
return [
'icons' => [
'navigation' => 'heroicon-o-exclamation-triangle',
'exception' => 'heroicon-o-exclamation-triangle',
'headers' => 'heroicon-o-arrows-right-left',
'cookies' => 'heroicon-o-circle-stack',
'body' => 'heroicon-s-code-bracket',
'queries' => 'heroicon-s-circle-stack',
],
];
And for logger
return [
'datetime_format' => 'm/d/Y H:i:s',
'date_format' => 'm/d/Y',

'activity_resource' => App\Filament\Resources\ActivityResource::class,

'resources' => [
...
],

'access' => [
...
],

'notifications' => [
...
],

'models' => [
...
],

'custom' => [
// [
// 'log_name' => 'Custom',
// 'color' => 'primary',
// ]
],
];
return [
'datetime_format' => 'm/d/Y H:i:s',
'date_format' => 'm/d/Y',

'activity_resource' => App\Filament\Resources\ActivityResource::class,

'resources' => [
...
],

'access' => [
...
],

'notifications' => [
...
],

'models' => [
...
],

'custom' => [
// [
// 'log_name' => 'Custom',
// 'color' => 'primary',
// ]
],
];
I second config I should add sorting to custom array, right?
7 replies