Skip to content

Commit a0077d0

Browse files
authored
Filament user trait and result stats error (alexjustesen#30)
1 parent f122b9d commit a0077d0

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

app/Filament/Resources/ResultResource/Widgets/StatsOverview.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ class StatsOverview extends BaseWidget
1313
protected function getCards(): array
1414
{
1515
return [
16-
Card::make('Latest download', formatBytes(Result::latest()->first()->download)),
17-
Card::make('Latest upload', formatBytes(Result::latest()->first()->upload)),
18-
Card::make('Latest ping', round(Result::latest()->first()->ping, 2)),
16+
Card::make('Latest download', formatBytes(Result::latest()->first()?->download ?: 0)),
17+
Card::make('Latest upload', formatBytes(Result::latest()->first()?->upload ?: 0)),
18+
Card::make('Latest ping', round(Result::latest()->first()?->ping ?: 0, 2)),
1919
];
2020
}
2121
}

app/Models/User.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
namespace App\Models;
44

55
// use Illuminate\Contracts\Auth\MustVerifyEmail;
6+
7+
use Filament\Models\Contracts\FilamentUser;
68
use Illuminate\Database\Eloquent\Factories\HasFactory;
79
use Illuminate\Foundation\Auth\User as Authenticatable;
810
use Illuminate\Notifications\Notifiable;
911
use Laravel\Sanctum\HasApiTokens;
1012

11-
class User extends Authenticatable
13+
class User extends Authenticatable implements FilamentUser
1214
{
1315
use HasApiTokens, HasFactory, Notifiable;
1416

0 commit comments

Comments
 (0)