Skip to content

Commit

Permalink
Add purchase assignment resource to filament.
Browse files Browse the repository at this point in the history
  • Loading branch information
timvandijck committed Mar 5, 2024
1 parent 2310e08 commit eb921ce
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
7 changes: 5 additions & 2 deletions app/Filament/Resources/Content/MemberResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Columns\ImageColumn;
use Filament\Tables\Columns\SpatieMediaLibraryImageColumn;
use Filament\Tables\Table;

class MemberResource extends Resource
{
protected static ?string $model = Member::class;

protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $navigationGroup = 'Members';

protected static ?int $navigationSort = 1;

protected static ?string $navigationIcon = 'heroicon-o-user-circle';

public static function form(Form $form): Form
{
Expand Down
21 changes: 18 additions & 3 deletions app/Filament/Resources/Customers/PurchaseAssignmentResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@

namespace App\Filament\Resources\Customers;

use App\Domain\Shop\Models\PurchaseAssignment;
use App\Filament\Resources\Customers;
use App\Models\PurchaseAssignment;
use App\Filament\Tables\Columns\BooleanColumn;
use App\Filament\Tables\Columns\ResourceLinkColumn;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;

class PurchaseAssignmentResource extends Resource
{
protected static ?string $model = PurchaseAssignment::class;

protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $navigationGroup = 'Customers';

protected static ?int $navigationSort = 8;

protected static ?string $navigationIcon = 'heroicon-o-user-plus';

public static function form(Form $form): Form
{
Expand All @@ -27,7 +34,15 @@ public static function table(Table $table): Table
{
return $table
->columns([
//
TextColumn::make('id')->sortable(),
ResourceLinkColumn::make('purchase.id',
fn(PurchaseAssignment $record) => route('filament.admin.resources.customers.purchases.edit', $record->purchase)
)
->state(fn(PurchaseAssignment $record) => '#' . $record->purchase->id . ' on ' . $record->purchase->created_at)
->sortable(),
TextColumn::make('purchasable.title')->sortable()->searchable(),
TextColumn::make('user.email')->sortable()->searchable(),
BooleanColumn::make('has_repository_access')->sortable(),
])
->filters([
//
Expand Down

0 comments on commit eb921ce

Please sign in to comment.