init
This commit is contained in:
232 files changed
+25416
No files matched your search
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BazaarReviews;
|
||||
|
||||
use App\Filament\Resources\BazaarReviews\Pages\ListBazaarReviews;
|
||||
use App\Filament\Resources\BazaarReviews\Pages\ViewBazaarReview;
|
||||
use App\Filament\Resources\BazaarReviews\Schemas\BazaarReviewForm;
|
||||
use App\Filament\Resources\BazaarReviews\Schemas\BazaarReviewInfolist;
|
||||
use App\Filament\Resources\BazaarReviews\Tables\BazaarReviewsTable;
|
||||
use App\Models\BazaarReview;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class BazaarReviewResource extends Resource
|
||||
{
|
||||
protected static ?string $model = BazaarReview::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Cafe Bazaar';
|
||||
|
||||
protected static ?string $navigationLabel = 'Reviews';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return BazaarReviewForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function infolist(Schema $schema): Schema
|
||||
{
|
||||
return BazaarReviewInfolist::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return BazaarReviewsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListBazaarReviews::route('/'),
|
||||
'view' => ViewBazaarReview::route('/{record}'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BazaarReviews\Pages;
|
||||
|
||||
use App\Filament\Resources\BazaarReviews\BazaarReviewResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateBazaarReview extends CreateRecord
|
||||
{
|
||||
protected static string $resource = BazaarReviewResource::class;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BazaarReviews\Pages;
|
||||
|
||||
use App\Filament\Resources\BazaarReviews\BazaarReviewResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditBazaarReview extends EditRecord
|
||||
{
|
||||
protected static string $resource = BazaarReviewResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
ViewAction::make(),
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BazaarReviews\Pages;
|
||||
|
||||
use App\Filament\Resources\BazaarReviews\BazaarReviewResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListBazaarReviews extends ListRecords
|
||||
{
|
||||
protected static string $resource = BazaarReviewResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BazaarReviews\Pages;
|
||||
|
||||
use App\Filament\Resources\BazaarReviews\BazaarReviewResource;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewBazaarReview extends ViewRecord
|
||||
{
|
||||
protected static string $resource = BazaarReviewResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BazaarReviews\Schemas;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class BazaarReviewForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
//
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BazaarReviews\Schemas;
|
||||
|
||||
use Filament\Infolists\Components\IconEntry;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class BazaarReviewInfolist
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextEntry::make('bazaar_review_id')->label('Bazaar review ID'),
|
||||
TextEntry::make('rate')->badge(),
|
||||
TextEntry::make('text')->columnSpanFull(),
|
||||
TextEntry::make('app_version_code'),
|
||||
IconEntry::make('is_edited')->boolean(),
|
||||
TextEntry::make('published_at')->dateTime(),
|
||||
TextEntry::make('developer_reply_text')->columnSpanFull(),
|
||||
TextEntry::make('developer_reply_email'),
|
||||
TextEntry::make('developer_replied_at')->dateTime(),
|
||||
TextEntry::make('bazaar_response')->formatStateUsing(fn (?array $state): string => json_encode($state, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE))->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BazaarReviews\Tables;
|
||||
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class BazaarReviewsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('rate')->badge()->sortable(),
|
||||
TextColumn::make('text')->limit(70)->searchable()->wrap(),
|
||||
TextColumn::make('app_version_code')->label('App version')->sortable(),
|
||||
IconColumn::make('replied')->label('Replied')->state(fn ($record): bool => filled($record->developer_reply_text))->boolean(),
|
||||
TextColumn::make('published_at')->dateTime()->sortable(),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('rate')->options([1 => '1 star', 2 => '2 stars', 3 => '3 stars', 4 => '4 stars', 5 => '5 stars']),
|
||||
])
|
||||
->recordActions([
|
||||
ViewAction::make(),
|
||||
])
|
||||
->defaultSort('published_at', 'desc');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user