Pints
Filament Shield: 1 Same Model in 2 Filament Resource
I have two resources that use the same model. When I assign a role that should only grant access to Resource 1, it doesn’t show up on the User’s dashboard. However, if I enable access to both Resource 1 and Resource 2 in the role settings for User, both resources appear in the dashboard, which is not expected because I only want Resource 1 to be visible in User Dashboard and both resource in Admin Dashboard.
How do I show only Resource 1 to User Dashboard?
3 replies
Accessing repeater value from outside
Need help, how do I get the value of those inside the repeater and make the price update every time I made changes inside the repeater?
This is my sample code:
Repeater::make('products')
->schema([
TextInput::make('quantity')
->live()
->default(100)
->afterStateUpdated(function (Set $set, $state) {
$set('quantity', $state);
})
TextInput::make('price')
->live()
->default(100)
->afterStateUpdated(function (Set $set, $state) {
$set('price', $state);
})
]),
TextInput::make('amount')
->default(function (Get $get) {
$quantity = (float) $get('../quantity');
$price = (float) $get('../price');
return $quantity * $price;
}),
It is always null.
12 replies