66 lines
1.9 KiB
PHP
66 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\TicketResource\RelationManagers;
|
|
|
|
use Filament\Forms;
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Forms\Components\Textarea;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Forms\Form;
|
|
use Filament\Resources\RelationManagers\RelationManager;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Table;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|
|
|
class ResponsesRelationManager extends RelationManager
|
|
{
|
|
protected static string $relationship = 'responses';
|
|
|
|
public function form(Form $form): Form
|
|
{
|
|
return $form
|
|
->schema([
|
|
Select::make('user_id')
|
|
->relationship('user', 'name')
|
|
->searchable()
|
|
->preload()
|
|
->default(1)
|
|
->required()
|
|
->columnSpanFull(),
|
|
Textarea::make('response')
|
|
->required()
|
|
->rows(7)
|
|
->maxLength(255)
|
|
->columnSpanFull(),
|
|
]);
|
|
}
|
|
|
|
public function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->recordTitleAttribute('response')
|
|
->columns([
|
|
TextColumn::make('user.name'),
|
|
TextColumn::make('ip_address'),
|
|
TextColumn::make('response'),
|
|
])
|
|
->filters([
|
|
//
|
|
])
|
|
->headerActions([
|
|
Tables\Actions\CreateAction::make(),
|
|
])
|
|
->actions([
|
|
Tables\Actions\EditAction::make(),
|
|
Tables\Actions\DeleteAction::make(),
|
|
])
|
|
->bulkActions([
|
|
Tables\Actions\BulkActionGroup::make([
|
|
Tables\Actions\DeleteBulkAction::make(),
|
|
]),
|
|
]);
|
|
}
|
|
}
|