Obala
Obala
Explore posts from servers
FFilament
Created by Obala on 9/3/2024 in #❓┊help
Multi sub domain session sharing
I think I had issues with the browser caching, cos it's working perfectly fine on another browser
5 replies
FFilament
Created by Obala on 9/3/2024 in #❓┊help
Multi sub domain session sharing
let me look it through, thanks
5 replies
FFilament
Created by Obala on 9/14/2023 in #❓┊help
how to set a value of an input field using values in a repeater
Thank you, let me test it out
9 replies
FFilament
Created by Obala on 9/14/2023 in #❓┊help
how to set a value of an input field using values in a repeater
it works with this but the problem when more that a single product is order for
TextInput::make('quantity')
->required()
->afterStateUpdated(fn ($state, Get $get, Set $set) => empty($get('../../total')) ? $set('../../total', $get('unit_price') * $state) : ($get('unit_price') * $state) + $get('../../total'))
->numeric(),
TextInput::make('quantity')
->required()
->afterStateUpdated(fn ($state, Get $get, Set $set) => empty($get('../../total')) ? $set('../../total', $get('unit_price') * $state) : ($get('unit_price') * $state) + $get('../../total'))
->numeric(),
9 replies
FFilament
Created by Obala on 9/14/2023 in #❓┊help
how to set a value of an input field using values in a repeater
where i tried implementing something like this
return $form
->schema([
Repeater::make('items')
->relationship()
->schema([
Select::make('shop_product_id')
->options(Product::query()->pluck('name', 'id'))
->label('Stock')
->native(false)
->afterStateUpdated(fn($state, Set $set) => $set('unit_price', Product::find($state)?->price ?? 0))
->placeholder('Select a drink'),
TextInput::make('quantity')
->required()
->afterStateUpdated(fn ($state, Set $set, Get $get) => $set('../../total', Product::find($get('shop_product_id')?->price * $state)?? 0))
->numeric(),
TextInput::make('unit_price')
->label('Unit Price')
->disabled()
->dehydrated()
->numeric()
->required()
->columnSpan([
'md' => 3,
]),
])->orderable()
->defaultItems(1)
->required(),

TextInput::make('total')
->disabled()
->required()
->numeric(),
]);
return $form
->schema([
Repeater::make('items')
->relationship()
->schema([
Select::make('shop_product_id')
->options(Product::query()->pluck('name', 'id'))
->label('Stock')
->native(false)
->afterStateUpdated(fn($state, Set $set) => $set('unit_price', Product::find($state)?->price ?? 0))
->placeholder('Select a drink'),
TextInput::make('quantity')
->required()
->afterStateUpdated(fn ($state, Set $set, Get $get) => $set('../../total', Product::find($get('shop_product_id')?->price * $state)?? 0))
->numeric(),
TextInput::make('unit_price')
->label('Unit Price')
->disabled()
->dehydrated()
->numeric()
->required()
->columnSpan([
'md' => 3,
]),
])->orderable()
->defaultItems(1)
->required(),

TextInput::make('total')
->disabled()
->required()
->numeric(),
]);
9 replies
FFilament
Created by Obala on 9/14/2023 in #❓┊help
how to set a value of an input field using values in a repeater
9 replies
FFilament
Created by Obala on 9/14/2023 in #❓┊help
how to set a value of an input field using values in a repeater
the problem is i want it to be shown in to the user while adding up the orders, though i don't want them to be able to change the total, i saw somewhere the use of placeholder but not sure if that could work
9 replies
FFilament
Created by Obala on 9/14/2023 in #❓┊help
how to set a value of an input field using values in a repeater
my codes look like this
Repeater::make('items')
->relationship()
->schema([
Select::make('shop_product_id')
->options(Product::query()->pluck('name', 'id'))
->label('Stock')
->native(false)
->afterStateUpdated(fn($state, Set $set) => $set('unit_price', Product::find($state)?->price ?? 0))
->placeholder('Select a drink'),
TextInput::make('quantity')
->required()
->numeric(),
TextInput::make('unit_price')
->label('Unit Price')
->disabled()dfd
->dehydrated()
->numeric()
->required()
->columnSpan([
'md' => 3,
]),
])->orderable()
->defaultItems(1)
->required(),

TextInput::make('total')
->disabled()
->required()
->numeric(),
]);
Repeater::make('items')
->relationship()
->schema([
Select::make('shop_product_id')
->options(Product::query()->pluck('name', 'id'))
->label('Stock')
->native(false)
->afterStateUpdated(fn($state, Set $set) => $set('unit_price', Product::find($state)?->price ?? 0))
->placeholder('Select a drink'),
TextInput::make('quantity')
->required()
->numeric(),
TextInput::make('unit_price')
->label('Unit Price')
->disabled()dfd
->dehydrated()
->numeric()
->required()
->columnSpan([
'md' => 3,
]),
])->orderable()
->defaultItems(1)
->required(),

TextInput::make('total')
->disabled()
->required()
->numeric(),
]);
9 replies
FFilament
Created by Obala on 9/4/2023 in #❓┊help
multiple logo for dark and light mode
i want inside this resources/views/vendor/filament-panels/components/logo.blade.php
4 replies
FFilament
Created by Obala on 9/4/2023 in #❓┊help
Edit resource page as the page index
clear views, route etc and tried this again and it works
public function create(): void
{
$setting = Setting::first();
$setting->fill($this->form->getState());
$setting->save();
}
public function create(): void
{
$setting = Setting::first();
$setting->fill($this->form->getState());
$setting->save();
}
36 replies
FFilament
Created by Obala on 9/4/2023 in #❓┊help
Edit resource page as the page index
No description
36 replies
FFilament
Created by Obala on 9/4/2023 in #❓┊help
Edit resource page as the page index
yes
36 replies
FFilament
Created by Obala on 9/4/2023 in #❓┊help
Edit resource page as the page index
i have protected $fillable
36 replies
FFilament
Created by Obala on 9/4/2023 in #❓┊help
Edit resource page as the page index
am not using id 😆 the primary key is set to company_name
36 replies
FFilament
Created by Obala on 9/4/2023 in #❓┊help
Edit resource page as the page index
yes its not nulled since the $this->getSetting(); retrieves the first row in the table
36 replies
FFilament
Created by Obala on 9/4/2023 in #❓┊help
Edit resource page as the page index
but again its not saving 😫
36 replies
FFilament
Created by Obala on 9/4/2023 in #❓┊help
Edit resource page as the page index
yes, after dumping $setting from the Setting $setting found it was empty so i change to this
public function create(): void
{
$setting = $this->getSetting();
$setting->update($this->data);
}
public function create(): void
{
$setting = $this->getSetting();
$setting->update($this->data);
}
36 replies
FFilament
Created by Obala on 9/4/2023 in #❓┊help
Edit resource page as the page index
with the dd($this->data); the data is dumped with no issues but $setting->update($this->data); still does not update the row
36 replies
FFilament
Created by Obala on 9/4/2023 in #❓┊help
Edit resource page as the page index
its not updating the row still
36 replies
FFilament
Created by Obala on 9/4/2023 in #❓┊help
Edit resource page as the page index
Yes, have noticed, now have changed to
public function mount(): void
{
$this->form->fill($this->getSetting()->toArray());

//And it works

}
public function mount(): void
{
$this->form->fill($this->getSetting()->toArray());

//And it works

}
But now ```php public function create(Setting $setting): void { $setting->update($this->form->getState()); $setting->save(); //Its just saving new setting row with all the fields to null }
36 replies