Proje dosyaları eklendi
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SerpChecks\Pages;
|
||||
|
||||
use App\Filament\Resources\SerpChecks\SerpCheckResource;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListSerpChecks extends ListRecords
|
||||
{
|
||||
protected static string $resource = SerpCheckResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SerpChecks\Pages;
|
||||
|
||||
use App\Filament\Resources\SerpChecks\SerpCheckResource;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewSerpCheck extends ViewRecord
|
||||
{
|
||||
protected static string $resource = SerpCheckResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SerpChecks\Schemas;
|
||||
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class SerpCheckInfolist
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema->components([
|
||||
TextEntry::make('ulid')->label('ULID'),
|
||||
TextEntry::make('phrase')->label(__('admin.keyword')),
|
||||
TextEntry::make('keyword.project.name')->label(__('admin.project')),
|
||||
TextEntry::make('keyword.project.domain')->label(__('admin.domain')),
|
||||
TextEntry::make('keyword.project.user.email')->label(__('admin.customer')),
|
||||
TextEntry::make('provider')->label(__('admin.provider'))->placeholder('—'),
|
||||
TextEntry::make('status')->label(__('admin.status'))->formatStateUsing(fn ($state) => $state->label()),
|
||||
TextEntry::make('result_count')->label(__('admin.result_count')),
|
||||
TextEntry::make('error_code')->label(__('admin.error_code'))->placeholder('—'),
|
||||
TextEntry::make('error_message')->label(__('admin.error_message'))->placeholder('—'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SerpChecks;
|
||||
|
||||
use App\Filament\Resources\SerpChecks\Pages\ListSerpChecks;
|
||||
use App\Filament\Resources\SerpChecks\Pages\ViewSerpCheck;
|
||||
use App\Filament\Resources\SerpChecks\Schemas\SerpCheckInfolist;
|
||||
use App\Filament\Resources\SerpChecks\Tables\SerpChecksTable;
|
||||
use App\Models\SerpCheck;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SerpCheckResource extends Resource
|
||||
{
|
||||
protected static ?string $model = SerpCheck::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedChartBar;
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('ui.serp_checks');
|
||||
}
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('resources.serp_check');
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('ui.serp_checks');
|
||||
}
|
||||
|
||||
public static function infolist(Schema $s): Schema
|
||||
{
|
||||
return SerpCheckInfolist::configure($s);
|
||||
}
|
||||
|
||||
public static function table(Table $t): Table
|
||||
{
|
||||
return SerpChecksTable::configure($t);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return ['index' => ListSerpChecks::route('/'), 'view' => ViewSerpCheck::route('/{record}')];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\SerpChecks\Tables;
|
||||
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SerpChecksTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table->modifyQueryUsing(fn ($query) => $query->with('keyword.project.user'))
|
||||
->columns([
|
||||
TextColumn::make('ulid')->label('ULID')->searchable(),
|
||||
TextColumn::make('phrase')->label(__('admin.keyword'))->searchable(),
|
||||
TextColumn::make('keyword.project.name')->label(__('admin.project'))->searchable(),
|
||||
TextColumn::make('keyword.project.domain')->label(__('admin.domain'))->searchable(),
|
||||
TextColumn::make('keyword.project.user.email')->label(__('admin.customer'))->searchable(),
|
||||
TextColumn::make('provider')->label(__('admin.provider'))->placeholder('—'),
|
||||
TextColumn::make('status')->label(__('admin.status'))->badge()->formatStateUsing(fn ($state) => $state->label()),
|
||||
TextColumn::make('result_count')->label(__('admin.result_count')),
|
||||
TextColumn::make('created_at')->label(__('admin.created_at'))->dateTime('d.m.Y H:i')->sortable(),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('status')->label(__('admin.status'))->options([
|
||||
'pending' => __('states.pending'), 'running' => __('states.running'),
|
||||
'completed' => __('states.completed'), 'failed' => __('states.failed'),
|
||||
]),
|
||||
SelectFilter::make('provider')->label(__('admin.provider')),
|
||||
SelectFilter::make('search_engine')->label(__('admin.search_engine'))->options(['google' => 'Google', 'bing' => 'Bing']),
|
||||
])->recordActions([ViewAction::make()])->toolbarActions([]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user