Lift_Kara_De
Lift_Kara_De
FFilament
Created by Lift_Kara_De on 7/27/2024 in #❓┊help
Opening related resource in its own page
Thanks @Dennis Koch and @kingjaypee12
15 replies
FFilament
Created by Lift_Kara_De on 7/27/2024 in #❓┊help
Opening related resource in its own page
This solves it I think
15 replies
FFilament
Created by Lift_Kara_De on 7/27/2024 in #❓┊help
Opening related resource in its own page
Yeah. I udnerstand the point on losing the hierarchy. Maybe i can make the modal much larger to accommodate more data while staying withn the page (https://github.com/filamentphp/filament/discussions/5468) or lose the hierarchy and go to the url anyway.
15 replies
FFilament
Created by Lift_Kara_De on 7/27/2024 in #❓┊help
Opening related resource in its own page
This look like the thing to do. Surprising why we can't easily switch between modal and view page like it is done in resources quite easily. Thanks a lot!
15 replies
FFilament
Created by Lift_Kara_De on 7/27/2024 in #❓┊help
Opening related resource in its own page
I don't require them on the edit page but rather on the view page. Here's the actual thing. On clicking on the "version" it shows the details in a modal. I just need it to open in a new page. Plugin hasMany Versions
15 replies
FFilament
Created by Lift_Kara_De on 7/27/2024 in #❓┊help
Opening related resource in its own page
@Dennis Koch Thanks! I don't think mine is a case of nested resources. I have a Software Resource which hasMany SoftwareVersions. My issue is at the UI level, where adding a relationManager as a table will list out the SoftwareVersions on the Software page but clicking it only shows SoftwareVersion info in a modal and not in its own page
15 replies
FFilament
Created by Lift_Kara_De on 7/27/2024 in #❓┊help
Opening related resource in its own page
<?php

namespace App\Filament\Resources\SoftwareResource\RelationManagers;


class VersionsRelationManager extends RelationManager {
protected static string $relationship = 'versions';

public function infolist(Infolist $infolist): Infolist {
return $infolist
->schema([
Section::make()->schema([
TextEntry::make('id')->label('ID'),
TextEntry::make('version')->label('Version'),
TextEntry::make('status')->label('Status')
->formatStateUsing(fn($state) => ucfirst($state)),
])
]);
}
public function form(Form $form): Form {
return $form;
}

public function table(Table $table): Table {
return $table
->recordTitleAttribute('id')
->columns([
TextColumn::make('id'),
TextColumn::make('version')->label('Version'),
TextColumn::make('status')->label('Status')
->formatStateUsing(fn($state) => ucfirst($state)),
])
->filters([
//
])
->headerActions([
Tables\Actions\CreateAction::make(),
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\ViewAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
}
<?php

namespace App\Filament\Resources\SoftwareResource\RelationManagers;


class VersionsRelationManager extends RelationManager {
protected static string $relationship = 'versions';

public function infolist(Infolist $infolist): Infolist {
return $infolist
->schema([
Section::make()->schema([
TextEntry::make('id')->label('ID'),
TextEntry::make('version')->label('Version'),
TextEntry::make('status')->label('Status')
->formatStateUsing(fn($state) => ucfirst($state)),
])
]);
}
public function form(Form $form): Form {
return $form;
}

public function table(Table $table): Table {
return $table
->recordTitleAttribute('id')
->columns([
TextColumn::make('id'),
TextColumn::make('version')->label('Version'),
TextColumn::make('status')->label('Status')
->formatStateUsing(fn($state) => ucfirst($state)),
])
->filters([
//
])
->headerActions([
Tables\Actions\CreateAction::make(),
])
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\ViewAction::make(),
Tables\Actions\DeleteAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
}
15 replies
FFilament
Created by Lift_Kara_De on 7/27/2024 in #❓┊help
Opening related resource in its own page
public static function infolist(Infolist $infolist): Infolist {
return $infolist
->schema([
Section::make()->schema([
TextEntry::make('id')->label('ID'),
TextEntry::make('name')->label('Name'),
}

public static function form(Form $form): Form
{
return $form;
}

public static function table(Table $table): Table
{
return $table
->columns([
// TextColumn::make('id')->label('ID'),

TextColumn::make('created_at')->label('Created At')
->getStateUsing(function ($record) {
return Carbon::parse($record->created_at);
}),
//updated_at
TextColumn::make('updated_at')->label('Updated At')
->getStateUsing(function ($record) {
return Carbon::parse($record->updated_at);
}),
])
->filters([
//
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}

public static function getRelations(): array
{
return [
RelationManagers\VersionsRelationManager::class,
];
}

public static function getPages(): array
{
return [
'index' => Pages\ListSoftwares::route('/'),
'create' => Pages\CreateSoftware::route('/create'),
'view' => Pages\ViewSoftware::route('/{record}'),
'edit' => Pages\EditSoftware::route('/{record}/edit'),
];
}
}
public static function infolist(Infolist $infolist): Infolist {
return $infolist
->schema([
Section::make()->schema([
TextEntry::make('id')->label('ID'),
TextEntry::make('name')->label('Name'),
}

public static function form(Form $form): Form
{
return $form;
}

public static function table(Table $table): Table
{
return $table
->columns([
// TextColumn::make('id')->label('ID'),

TextColumn::make('created_at')->label('Created At')
->getStateUsing(function ($record) {
return Carbon::parse($record->created_at);
}),
//updated_at
TextColumn::make('updated_at')->label('Updated At')
->getStateUsing(function ($record) {
return Carbon::parse($record->updated_at);
}),
])
->filters([
//
])
->actions([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}

public static function getRelations(): array
{
return [
RelationManagers\VersionsRelationManager::class,
];
}

public static function getPages(): array
{
return [
'index' => Pages\ListSoftwares::route('/'),
'create' => Pages\CreateSoftware::route('/create'),
'view' => Pages\ViewSoftware::route('/{record}'),
'edit' => Pages\EditSoftware::route('/{record}/edit'),
];
}
}
15 replies