Aminne
Aminne
FFilament
Created by Aminne on 6/23/2024 in #❓┊help
Problem on Phone Input
->searchable(),
PhoneInput::make('phone')
->required()
->defaultCountry('my')
->initialCountry('my')
->validationMessages([
'phone:MY' => 'The phone not number'
])
->validateFor(
country: 'MY',
// type: libPhoneNumberType::MOBILE | libPhoneNumberType::FIXED_LINE,
lenient: true,
),
->searchable(),
PhoneInput::make('phone')
->required()
->defaultCountry('my')
->initialCountry('my')
->validationMessages([
'phone:MY' => 'The phone not number'
])
->validateFor(
country: 'MY',
// type: libPhoneNumberType::MOBILE | libPhoneNumberType::FIXED_LINE,
lenient: true,
),
` I got the probelm on libPhoneNumberType not found
4 replies
FFilament
Created by Aminne on 6/23/2024 in #❓┊help
custom select componenet with phone code , and country emoji
Hello, in select componenet of filament i want to display all phone code , and country emoji, with input to enter the phone number , any recommendations to doing this ?
4 replies
FFilament
Created by Aminne on 6/22/2024 in #❓┊help
Custom validation message is not working
TextInput::make('amount')
->numeric()
->required()
->live(onBlur: true)
->validationMessages(['min:0' => 'Invalid balance'])
->minValue(0)
TextInput::make('amount')
->numeric()
->required()
->live(onBlur: true)
->validationMessages(['min:0' => 'Invalid balance'])
->minValue(0)
2 replies
FFilament
Created by Aminne on 6/21/2024 in #❓┊help
Bug in Select Form Component Toggle Disable Enable
I would like to know if this bug is resolved or not ?
7 replies
FFilament
Created by Aminne on 6/21/2024 in #❓┊help
Failed to disabled select before another select
Forms\Components\Select::make('from_id')
->relationship(name: 'from',
modifyQueryUsing: fn (Builder $query, Get $get) => $query->where('id', '!=', $get('to_id')))
->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->holder->name}")
->preload()
->searchable()
->required()
->live()
->native(false),Forms\Components\Select::make('to_id')
->relationship(name: 'to',
modifyQueryUsing: fn (Builder $query, Get $get) => $query->where('id', '!=', $get('from_id')))
->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->holder->name}")
->disabled(function(Get $get) {
return is_null($get('from_id'));
})
->live()
->preload()
->searchable()
->required()
->native(false)
Forms\Components\Select::make('from_id')
->relationship(name: 'from',
modifyQueryUsing: fn (Builder $query, Get $get) => $query->where('id', '!=', $get('to_id')))
->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->holder->name}")
->preload()
->searchable()
->required()
->live()
->native(false),Forms\Components\Select::make('to_id')
->relationship(name: 'to',
modifyQueryUsing: fn (Builder $query, Get $get) => $query->where('id', '!=', $get('from_id')))
->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->holder->name}")
->disabled(function(Get $get) {
return is_null($get('from_id'));
})
->live()
->preload()
->searchable()
->required()
->native(false)
Firstly to_id select is disabled before selected the from_id i have this code , The problem after select the from_id , to_id is disabled but i can't open the options ?
4 replies
FFilament
Created by Aminne on 6/21/2024 in #❓┊help
How i can disable submit button until form is fully validated filament
No description
3 replies
FFilament
Created by Aminne on 6/21/2024 in #❓┊help
How i can display the error message before submit
Forms\Components\Select::make('from_id')
->relationship(name: 'from',
modifyQueryUsing: fn (Builder $query, Get $get) => $query->where('id', '!=', $get('to_id')))
->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->holder->name}")
->preload()
->searchable()
->required()
->live(onBlur: true)
->afterStateUpdated(function (Forms\Contracts\HasForms $livewire, Forms\Components\Select $component) {
$livewire->validateOnly($component->getStatePath());
})
->rules([
fn () => function (string $attribute, $value, Closure $fail) {
$wallet = Wallet::find($value);
if(intval($wallet->balance) === 0) {
$fail('The :attribute wallet is empty.');
}
},
]),
Forms\Components\Select::make('from_id')
->relationship(name: 'from',
modifyQueryUsing: fn (Builder $query, Get $get) => $query->where('id', '!=', $get('to_id')))
->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->holder->name}")
->preload()
->searchable()
->required()
->live(onBlur: true)
->afterStateUpdated(function (Forms\Contracts\HasForms $livewire, Forms\Components\Select $component) {
$livewire->validateOnly($component->getStatePath());
})
->rules([
fn () => function (string $attribute, $value, Closure $fail) {
$wallet = Wallet::find($value);
if(intval($wallet->balance) === 0) {
$fail('The :attribute wallet is empty.');
}
},
]),
2 replies
FFilament
Created by Aminne on 6/21/2024 in #❓┊help
How i can custom failure form in custom action
This's my code
Actions\Action::make('newUser')
->action(function (array $data): void {`})->form(function(array data): void {})
Actions\Action::make('newUser')
->action(function (array $data): void {`})->form(function(array data): void {})
30 replies
FFilament
Created by Aminne on 6/20/2024 in #❓┊help
Add a event in user after creation
class CreateUser extends CreateRecord
{
protected static string $resource = UserResource::class;

protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('index');
}

protected function afterCreate(User $record)
{
$record->delete();
}
class CreateUser extends CreateRecord
{
protected static string $resource = UserResource::class;

protected function getRedirectUrl(): string
{
return $this->getResource()::getUrl('index');
}

protected function afterCreate(User $record)
{
$record->delete();
}
4 replies
FFilament
Created by Aminne on 6/19/2024 in #❓┊help
Remove the item selected in another select
I tried this but it deson't work
Group::make([
Forms\Components\Select::make('from_id')
->relationship('from', fn (Builder $query, Get $get) => $query->where('id', '!=', $get('to_id')))
->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->holder->name}")
->preload()
->searchable()
->required()
->live(onBlur: true),
Forms\Components\Select::make('to_id')
->relationship('from', fn (Builder $query, Get $get) => $query->where('id', '!=', $get('from_id')))
->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->holder->name}")
->preload()
->searchable()
->required()
->live(onBlur: true),
])->columns(2),
Group::make([
Forms\Components\Select::make('from_id')
->relationship('from', fn (Builder $query, Get $get) => $query->where('id', '!=', $get('to_id')))
->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->holder->name}")
->preload()
->searchable()
->required()
->live(onBlur: true),
Forms\Components\Select::make('to_id')
->relationship('from', fn (Builder $query, Get $get) => $query->where('id', '!=', $get('from_id')))
->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->holder->name}")
->preload()
->searchable()
->required()
->live(onBlur: true),
])->columns(2),
3 replies
FFilament
Created by Aminne on 6/14/2024 in #❓┊help
Adding where condition for filter in statsOverviewWidget
Tables\Filters\SelectFilter::make('category')
->relationship('categories', 'name')
->searchable()
->preload()
Tables\Filters\SelectFilter::make('category')
->relationship('categories', 'name')
->searchable()
->preload()
use InteractsWithPageTable;

protected function getTablePage(): string
{
return ListPosts::class;
}

protected function getStats(): array
{
return [
BaseWidget\Stat::make('Published Post', $this->getPageTableQuery()
->with('categories')
->whereRelation('category', 'title', '', '')
->where('status', 'published')
->count())
->description('All published posts')
->color('success'),
use InteractsWithPageTable;

protected function getTablePage(): string
{
return ListPosts::class;
}

protected function getStats(): array
{
return [
BaseWidget\Stat::make('Published Post', $this->getPageTableQuery()
->with('categories')
->whereRelation('category', 'title', '', '')
->where('status', 'published')
->count())
->description('All published posts')
->color('success'),
2 replies
FFilament
Created by Aminne on 6/11/2024 in #❓┊help
Tiptap-editor format stored
i stored the html format using this plugin, this the data obtened
{"ms_MY":"<p>malay</p>","en_US":{"type":"doc","content":[{"type":"paragraph","attrs":{"class":null,"style":null,"textAlign":"start"},"content":[{"type":"text","text":"content"}]}]}}
{"ms_MY":"<p>malay</p>","en_US":{"type":"doc","content":[{"type":"paragraph","attrs":{"class":null,"style":null,"textAlign":"start"},"content":[{"type":"text","text":"content"}]}]}}
5 replies
FFilament
Created by Aminne on 6/9/2024 in #❓┊help
How can I create my own plugin?
I need resources to help me for doing that.
2 replies
FFilament
Created by Aminne on 6/7/2024 in #❓┊help
Tiptap-editor display the content
I want to display the data created by the Tiptap editor on the Next.js application. I send my data via an API using Laravel.
9 replies