F
Filament15mo ago
vas

Integer value displayed incorrectly

hey i have the following table column
$table->bigInteger('steam_id')->nullable();
$table->bigInteger('steam_id')->nullable();
with the value of 76561198065698992 in the db , and table view is the same but when i click edit is being displayed as 76561198065698990 so the 2 at the end is 0 any idea what is causing this
Forms\Components\TextInput::make('steam_id')
->required()
->numeric(),


Tables\Columns\TextColumn::make('steam_id')
->numeric()
->sortable(),
Forms\Components\TextInput::make('steam_id')
->required()
->numeric(),


Tables\Columns\TextColumn::make('steam_id')
->numeric()
->sortable(),
16 Replies
vas
vasOP15mo ago
i have removed the numeric() and its the same
toeknee
toeknee15mo ago
You are likely casting it to a float? there is a limitation with floating-point numbers. So usually you overcome it with the likes of bcmath. What does your model look like
vas
vasOP15mo ago
class Token extends Model
{
use HasFactory;

protected $fillable = [
'balance',
'steam_id',
];


}
class Token extends Model
{
use HasFactory;

protected $fillable = [
'balance',
'steam_id',
];


}
vas
vasOP15mo ago
No description
vas
vasOP15mo ago
No description
vas
vasOP15mo ago
class EditToken extends EditRecord
{
protected static string $resource = TokenResource::class;

protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}
}
class EditToken extends EditRecord
{
protected static string $resource = TokenResource::class;

protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}
}
Dennis Koch
Dennis Koch15mo ago
What does Token::find(1)->toArray() return? Nevermind. Don't think that's an issue
vas
vasOP15mo ago
= [
"id" => 1,
"balance" => 1111,
"steam_id" => 76561198065698992,
"created_at" => "2023-09-06T13:57:48.000000Z",
"updated_at" => "2023-09-06T13:57:48.000000Z",
]
= [
"id" => 1,
"balance" => 1111,
"steam_id" => 76561198065698992,
"created_at" => "2023-09-06T13:57:48.000000Z",
"updated_at" => "2023-09-06T13:57:48.000000Z",
]
Dennis Koch
Dennis Koch15mo ago
Can you check the HTML. Is any validation on the form element?
vas
vasOP15mo ago
well i've used artisan make:filament-resource Token --generate for this i have pasted all there is regarding this resource
Dennis Koch
Dennis Koch15mo ago
Why did you include the form input twice? Or is this only the versions you tried? Is this v3?
vas
vasOP15mo ago
v3 i haven't included the form twice
<input id="data.steam_id" required="required" type="text" wire:model="data.steam_id">
<input id="data.steam_id" required="required" type="text" wire:model="data.steam_id">
i trimmed out the tailwind classes , but this is the html that is being generated when inspecting the input field
Dennis Koch
Dennis Koch15mo ago
Looks fine to me
vas
vasOP15mo ago
its weird , maybe try replicating it ? its a pretty simple resource
Schema::create('tokens', function (Blueprint $table) {
$table->id();
$table->integer('balance')->default(0);
$table->bigInteger('steam_id');
$table->timestamps();
});
Schema::create('tokens', function (Blueprint $table) {
$table->id();
$table->integer('balance')->default(0);
$table->bigInteger('steam_id');
$table->timestamps();
});
i need to go pickup my daughter , i will get back to you if you find anything i would appreciate the help thanks
LeandroFerreira
LeandroFerreira15mo ago
->formatStateUsing(fn ($state): string => strval($state))
->formatStateUsing(fn ($state): string => strval($state))
?
vas
vasOP15mo ago
that works thank you very much
Want results from more Discord servers?
Add your server