atabegruslan
atabegruslan
Explore posts from servers
FFilament
Created by atabegruslan on 8/29/2024 in #❓┊help
Display a field as formatted json
Thank you
8 replies
FFilament
Created by atabegruslan on 8/27/2024 in #❓┊help
Conditionally add and update relations
No description
16 replies
FFilament
Created by atabegruslan on 8/27/2024 in #❓┊help
Conditionally add and update relations
Actually, policy is only half the answer. Normally, you create a policy, then you apply it in controller method, like $this->authorize('action', $modelInstance); But Filament have its own controllers. It doesnt go thru any of the controllers that I wrote. Hence in this situation, how can policy (or any type of pre-saving checks) be done upon the click of the add/delete/edit buttons?
16 replies
FFilament
Created by atabegruslan on 8/29/2024 in #❓┊help
1 Select input depends on another Select input's value. Select's options populated by DB table's col
Is there a better way?
7 replies
FFilament
Created by atabegruslan on 8/29/2024 in #❓┊help
1 Select input depends on another Select input's value. Select's options populated by DB table's col
I have to save it first, then come back to edit it
7 replies
FFilament
Created by atabegruslan on 8/29/2024 in #❓┊help
1 Select input depends on another Select input's value. Select's options populated by DB table's col
Yes, the solution is good, except it does not update "on the fly"
7 replies
FFilament
Created by atabegruslan on 8/29/2024 in #❓┊help
Display a field as formatted json
How do you create custom columns?
8 replies
FFilament
Created by atabegruslan on 8/27/2024 in #❓┊help
Conditionally add and update relations
Thank you
16 replies
FFilament
Created by atabegruslan on 8/27/2024 in #❓┊help
Conditionally add and update relations
How exactly do you do that? Something more specific please
16 replies
FFilament
Created by atabegruslan on 8/23/2024 in #❓┊help
Conditionally display a section, based on another field's value
No. I tried something else too, but still same result (with an empty section). Below is Filament Resource for Delivery model, infolist function:
Components\RepeatableEntry::make('order.addresses') // <---- There's 2 types of addresses: Shipping and Billing
->schema([
Components\TextEntry::make('address_line_1')
]) // <--- If I use "->visible(fn($record) => ...)" here, $record is not the Address object (which is a problem), it's actually the Delivery model
Components\RepeatableEntry::make('order.addresses') // <---- There's 2 types of addresses: Shipping and Billing
->schema([
Components\TextEntry::make('address_line_1')
]) // <--- If I use "->visible(fn($record) => ...)" here, $record is not the Address object (which is a problem), it's actually the Delivery model
PS: Delivery is associated with an Order. Order is associated with a pair of Addresses, like $delivery->order->addresses
7 replies
FFilament
Created by atabegruslan on 8/27/2024 in #❓┊help
Conditionally add and update relations
Sorry I am out and I only have my phone
16 replies
FFilament
Created by atabegruslan on 8/27/2024 in #❓┊help
Conditionally add and update relations
Here:
class UserResource extends Resource
{
protected static ?string $model = User::class;

public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Section::make()->schema([
// ...
]),
Forms\Components\Section::make()->schema([
Forms\Components\Repeater::make('addresses')
->relationship()
->schema([
// Todo: can only chose 1 of type shipping and 1 of type billing <<--------*********
Forms\Components\TextInput::make('email'),
Forms\Components\TextInput::make('address_line_1'),
Forms\Components\TextInput::make('city'),
Forms\Components\TextInput::make('zip_code'),
Forms\Components\TextInput::make('state'),
])
->addable(false) // Todo: Can only add 1 shipping and 1 billing <<--------*********
->itemLabel(fn (array $state) => $state['type'])
])
]);
}
class UserResource extends Resource
{
protected static ?string $model = User::class;

public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Section::make()->schema([
// ...
]),
Forms\Components\Section::make()->schema([
Forms\Components\Repeater::make('addresses')
->relationship()
->schema([
// Todo: can only chose 1 of type shipping and 1 of type billing <<--------*********
Forms\Components\TextInput::make('email'),
Forms\Components\TextInput::make('address_line_1'),
Forms\Components\TextInput::make('city'),
Forms\Components\TextInput::make('zip_code'),
Forms\Components\TextInput::make('state'),
])
->addable(false) // Todo: Can only add 1 shipping and 1 billing <<--------*********
->itemLabel(fn (array $state) => $state['type'])
])
]);
}
(Updated. Sorry about the screenshot earlier. I replaced that image attachment with text code now)
16 replies
FFilament
Created by atabegruslan on 8/27/2024 in #❓┊help
Conditionally add and update relations
Yes. But a more detailed answer please
16 replies
FFilament
Created by atabegruslan on 8/23/2024 in #❓┊help
TextInput, set default value (from backend)
Thank you
16 replies
FFilament
Created by atabegruslan on 8/23/2024 in #❓┊help
TextInput, set default value (from backend)
Ok. I just need a label, showing the user name in the form. How can that be done?
16 replies
FFilament
Created by atabegruslan on 8/26/2024 in #❓┊help
Format currency
Thank you
5 replies
FFilament
Created by atabegruslan on 8/23/2024 in #❓┊help
TextInput, set default value (from backend)
Yes, your way works for select. But how about for TextInput?
16 replies
FFilament
Created by atabegruslan on 8/23/2024 in #❓┊help
Conditionally display a section, based on another field's value
Is there a better way?
7 replies
FFilament
Created by atabegruslan on 8/23/2024 in #❓┊help
Conditionally display a section, based on another field's value
No description
7 replies
FFilament
Created by atabegruslan on 8/23/2024 in #❓┊help
Conditionally display a section, based on another field's value
Thank you
7 replies