Robin
Robin
FFilament
Created by KeyMe on 2/27/2024 in #❓┊help
Access repeater item value from outside
this is probably a decade later but anyway, using
$values = array_values($get('repeaterName'));
$values = array_values($get('repeaterName'));
should have fixed it by returning numeric keys
2 replies
FFilament
Created by Panda on 7/23/2024 in #❓┊help
How to edit resource properties on simple resource creation?
when using simple resource, a ManageXXX is also created, there's a getHeaderActions() function that returns an array of actions, by default a CreateAction is present, you can chain createAnother and mutateFormDataUsing like,
Actions\CreateAction::make()
->createAnother(false) // disables create another
->mutateFormDataUsing(function(array $data){
$data['...'] = '...'
return $data;
})
Actions\CreateAction::make()
->createAnother(false) // disables create another
->mutateFormDataUsing(function(array $data){
$data['...'] = '...'
return $data;
})
4 replies
FFilament
Created by Robin on 7/12/2024 in #❓┊help
setting default active tab when testing
works, thanks!
5 replies
FFilament
Created by Robin on 3/19/2024 in #❓┊help
Loading indicator
Sure, used some other 'hacky' way to pass the arguments but this should fix the issue thanks 👍
8 replies
FFilament
Created by Robin on 3/19/2024 in #❓┊help
Loading indicator
@foreach ($rooms as $room)
<div wire:key="{{ $room->id }}">
<div class="flex justify-end">
<x-filament::badge color="{{ $room->status->getColor() }}" class="w-max">
{{ $room->status->getLabel() }}
</x-filament::badge>
</div>
{{ $this->cancelAction }

</div>
@endforeach
@foreach ($rooms as $room)
<div wire:key="{{ $room->id }}">
<div class="flex justify-end">
<x-filament::badge color="{{ $room->status->getColor() }}" class="w-max">
{{ $room->status->getLabel() }}
</x-filament::badge>
</div>
{{ $this->cancelAction }

</div>
@endforeach
8 replies
FFilament
Created by Robin on 2/24/2024 in #❓┊help
Export Action
for the time I added a custom filter (from filament docs), that lets the user select from date A to date B, this is the code
->filters([

Filter::make('created_at')
->form([
DatePicker::make('created_from'),
DatePicker::make('created_until'),
])
->query(function (Builder $query, array $data): Builder {
return $query
->when(
$data['created_from'],
fn (Builder $query, $date): Builder => $query->whereDate('created_at', '>=', $date),
)
->when(
$data['created_until'],
fn (Builder $query, $date): Builder => $query->whereDate('created_at', '<=', $date),
);
}),
])
->filters([

Filter::make('created_at')
->form([
DatePicker::make('created_from'),
DatePicker::make('created_until'),
])
->query(function (Builder $query, array $data): Builder {
return $query
->when(
$data['created_from'],
fn (Builder $query, $date): Builder => $query->whereDate('created_at', '>=', $date),
)
->when(
$data['created_until'],
fn (Builder $query, $date): Builder => $query->whereDate('created_at', '<=', $date),
);
}),
])
the export action automatically gets the filters selected
5 replies
FFilament
Created by Robin on 2/24/2024 in #❓┊help
Export Action
nvm got a soultion for that, when using exportaction in a table it takes all the applied filters 😀
5 replies
FFilament
Created by Jakub on 2/7/2024 in #❓┊help
default slideover
In the boot method of AppServiceProvider add
CreateAction::configureUsing(
function ($action){
return $action->slideOver();
})
CreateAction::configureUsing(
function ($action){
return $action->slideOver();
})
5 replies
FFilament
Created by Robin on 12/27/2023 in #❓┊help
accessing create functions inside a custom filament page
yep, this is it, just solved it after moving
$this->form->model($record)->saveRelationships();
$this->form->model($record)->saveRelationships();
before the foreach loop Many thanks!
12 replies
FFilament
Created by Robin on 12/27/2023 in #❓┊help
accessing create functions inside a custom filament page
Illuminate\Database\Eloquent\Collection {#2876 ▼ // app/Filament/Pages/NewSale.php:210
#items: []
#escapeWhenCastingToString: false
}
Illuminate\Database\Eloquent\Collection {#2876 ▼ // app/Filament/Pages/NewSale.php:210
#items: []
#escapeWhenCastingToString: false
}
12 replies
FFilament
Created by Robin on 12/27/2023 in #❓┊help
accessing create functions inside a custom filament page
the salesStores is a pivot table between sales and store, when I dd it returns an empty array 😅
12 replies
FFilament
Created by Robin on 12/27/2023 in #❓┊help
accessing create functions inside a custom filament page
so, I've got this function, it's succesfully saved but when updating the $new_qty nothing happens, I needed it to decrement the 'qty' with $new
public function create(): void
{
$data = $this->form->getState();
$record = Sale::create($data);

$sale_id = $record->id;
// dd($sale_id);
$saleStores = SaleStore::where('sale_id', $sale_id)->get();
foreach ($saleStores as $saleStore) {
$s_qty = $saleStore->selected_qty;
$store_id = $saleStore->store_id;
$store_qty = Store::find($store_id)->qty;
$new_qty = $store_qty - $s_qty;
Store::find($store_id)->update(['qty' => $new_qty]);
}

$record->balance_price = $record->sub_total;
$record->update(['balance_price_price' => $record->partial_price]);

$this->form->model($record)->saveRelationships();
$this->form->fill();
}
public function create(): void
{
$data = $this->form->getState();
$record = Sale::create($data);

$sale_id = $record->id;
// dd($sale_id);
$saleStores = SaleStore::where('sale_id', $sale_id)->get();
foreach ($saleStores as $saleStore) {
$s_qty = $saleStore->selected_qty;
$store_id = $saleStore->store_id;
$store_qty = Store::find($store_id)->qty;
$new_qty = $store_qty - $s_qty;
Store::find($store_id)->update(['qty' => $new_qty]);
}

$record->balance_price = $record->sub_total;
$record->update(['balance_price_price' => $record->partial_price]);

$this->form->model($record)->saveRelationships();
$this->form->fill();
}
12 replies
FFilament
Created by Robin on 12/27/2023 in #❓┊help
accessing create functions inside a custom filament page
I needed a create page on the navbar, so I created a new custom page, and copy pasted the from in resourceA, in the resource A, I had some lifecycle hooks functions on the CreatePage of resource A such as afterCreate() which updated the value of another field with the created field
12 replies
FFilament
Created by Robin on 12/25/2023 in #❓┊help
Repeater
12 replies
FFilament
Created by Robin on 12/25/2023 in #❓┊help
Repeater
Item1 and item 2 are they both inside the repeater?
12 replies
FFilament
Created by Robin on 12/25/2023 in #❓┊help
Repeater
Unless you trying to do the same thing 😃
12 replies
FFilament
Created by Robin on 12/25/2023 in #❓┊help
Repeater
what I'm tryna do is now acces the values (inside the repeater), outside the repeater
12 replies
FFilament
Created by Robin on 12/25/2023 in #❓┊help
Repeater
If that's your case, there's an answer already in the docs, a sec I'll send you the link
12 replies
FFilament
Created by Robin on 12/25/2023 in #❓┊help
Repeater
that is, using $set/$get outise repeater to access fields inside the repeater
12 replies