Crater
Crater
FFilament
Created by Crater on 9/18/2023 in #❓┊help
problems with Repeater default array from a Select
->default(function (callable $get) it's right?
4 replies
FFilament
Created by Crater on 9/18/2023 in #❓┊help
problems with Repeater default array from a Select
Forms\Components\Select::make('purchase_request_id')
->afterStateUpdated(function (callable $get, callable $set) {
$listItems = PurchaseOrderItem::where('order_id', $get('purchase_request_id'))->get();
$set('items', $listItems);
})->reactive(),

Forms\Components\Repeater::make('items')
->schema([...])
->default(function (callable $get) {
$data = $get('items');
return $data;
})

// out: null
Forms\Components\Select::make('purchase_request_id')
->afterStateUpdated(function (callable $get, callable $set) {
$listItems = PurchaseOrderItem::where('order_id', $get('purchase_request_id'))->get();
$set('items', $listItems);
})->reactive(),

Forms\Components\Repeater::make('items')
->schema([...])
->default(function (callable $get) {
$data = $get('items');
return $data;
})

// out: null
4 replies
FFilament
Created by Crater on 9/11/2023 in #❓┊help
Deny access to registry queries if it is not in your registry
hi @awcodes , Currently it is like this, and I use it to shield roles and permissions, what should I change?
public function viewAny(User $user)
{
return $user->can('view_any_store::stores');
}
public function viewAny(User $user)
{
return $user->can('view_any_store::stores');
}
8 replies
FFilament
Created by Crater on 9/9/2023 in #❓┊help
How can I prevent a TextInput from the form from being registered or sent to the new record?
done. 👍
19 replies
FFilament
Created by Crater on 9/9/2023 in #❓┊help
How can I prevent a TextInput from the form from being registered or sent to the new record?
OK, any clear example of where to use it or in what class? thx
19 replies
FFilament
Created by Crater on 9/9/2023 in #❓┊help
How can I prevent a TextInput from the form from being registered or sent to the new record?
In my case, to make a new record when entering the item in the warehouse. I require the product id and the warehouse id, but since it is in a ProductsRelationManager with the ownerRecord I get the warehouse id. How can I pass the warehouse ID to the record without showing it in the form? @awcodes @wyChoong 🤔
19 replies
FFilament
Created by Crater on 9/9/2023 in #❓┊help
How can I prevent a TextInput from the form from being registered or sent to the new record?
not for the id record but for autogenerators such as the slug or a code string F0001 it is right?
19 replies
FFilament
Created by Crater on 9/9/2023 in #❓┊help
How can I prevent a TextInput from the form from being registered or sent to the new record?
Solved:
use Filament\Forms\Components\Hidden;

Hidden::make('code')
use Filament\Forms\Components\Hidden;

Hidden::make('code')
https://filamentphp.com/docs/2.x/forms/fields#hidden
19 replies
FFilament
Created by Crater on 9/9/2023 in #❓┊help
How can I prevent a TextInput from the form from being registered or sent to the new record?
TextInput ->disabled()?
19 replies