-
-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #706 from pinkary-project/feat/pan-in-admin
[wip] Feat: pan-in-admin
- Loading branch information
Showing
4 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Widgets; | ||
|
||
use Filament\Tables; | ||
use Filament\Tables\Table; | ||
use Filament\Widgets\TableWidget as BaseWidget; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
final class Analytics extends BaseWidget | ||
{ | ||
/** | ||
* @var int | string | array<string, int | null> | ||
*/ | ||
protected int | string | array $columnSpan = 'full'; | ||
|
||
/** | ||
* The table that will be displayed in the widget. | ||
*/ | ||
public function table(Table $table): Table | ||
{ | ||
$panAnalytics = new class extends Model | ||
{ | ||
protected $table = 'pan_analytics'; | ||
}; | ||
|
||
return $table | ||
->query( | ||
$panAnalytics::query() | ||
) | ||
->columns([ | ||
Tables\Columns\TextColumn::make('name'), | ||
Tables\Columns\TextColumn::make('impressions'), | ||
Tables\Columns\TextColumn::make('hovers'), | ||
Tables\Columns\TextColumn::make('clicks'), | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use App\Filament\Widgets\Analytics; | ||
use App\Models\User; | ||
|
||
it('does renders', function () { | ||
$this->actingAs(User::factory()->create([ | ||
'email' => '[email protected]', | ||
])) | ||
->get('citadel/') | ||
->assertSeeLivewire(Analytics::class) | ||
->assertStatus(200); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
use App\Filament\Widgets\Analytics; | ||
use Livewire\Livewire; | ||
|
||
test('displays the analytics', function () { | ||
Livewire::test(Analytics::class) | ||
->assertSee('Analytics'); | ||
}); |