RelationManager not visible in Resource's own tab
public static function getRelations(): array
{
return [
RelationManagers\TicketLogsRelationManager::class,
];
}
<?php
namespace App\Filament\Clusters\Helpdesk\Resources\Tickets\RelationManagers;
class TicketLogsRelationManager extends RelationManager
{
protected static string $relationship = 'logs';
protected static ?string $recordTitleAttribute = 'action';
protected static ?string $title = 'Nhật ký công việc';
public function form(Schema $schema): Schema
{
return $schema->schema([
TextInput::make('action')
->label('Hành động')
->required(),
Textarea::make('content')
->label('Nội dung'),
Select::make('executors')
->label('Người thực hiện')
->multiple()
->searchable()
->options(
fn() => PhuTrach::with('NhanSu')
->get()
->pluck('NhanSu.fullname', 'nhansu_id')
->toArray()
)
->columnSpanFull(),
]);
}
public function table(Tables\Table $table): Tables\Table
{
return $table
->columns([
]) ->headerActions([ CreateAction::make(), ]) ->actions([ EditAction::make(), DeleteAction::make(), ]) ->defaultSort('created_at', 'desc'); } }
]) ->headerActions([ CreateAction::make(), ]) ->actions([ EditAction::make(), DeleteAction::make(), ]) ->defaultSort('created_at', 'desc'); } }

4 Replies
Please read #⚠ READ BEFORE POSTING. Format your code properly and add some information to your post.
I don't understand your issue. Your screenshot clearly shows the RM
RelationManager is not showing in a separate tab but showing right below. I want it to show in a side tab
// 👇 Bắt buộc relation managers hiển thị ở tab riêng
public static bool $shouldCombineRelationManagerTabsWithForm = false;
public function hasCombinedRelationManagerTabsWithContent(): bool
{
return false; // false = tabs riêng biệt, true = gộp với form
}
does not display correctly
class ViewTicket extends ViewRecord
{
protected static string $resource = TicketResource::class;
// 👇 Cho relation managers hiển thị dưới dạng tab
public function hasCombinedRelationManagerTabsWithContent(): bool
{
return false;
}
}
//
<?php
namespace App\Filament\Clusters\Helpdesk\Resources\Tickets\Pages;
use App\Filament\Clusters\Helpdesk\Resources\Tickets\TicketResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
use Filament\Support\Enums\Width;
class EditTicket extends EditRecord
{
protected static string $resource = TicketResource::class;
protected function getHeaderActions(): array
{
return [
// DeleteAction::make(),
];
}
public function getMaxContentWidth(): Width
{
return Width::Full;
}
/
* Sau khi lưu form sẽ quay về trang danh sách Ticket
*/
protected function getRedirectUrl(): string
{
// quay về trang danh sách Ticket
return $this->getResource()::getUrl('index');
}
/
* Hiển thị relation managers trong TAB riêng thay vì inline
*/
// QUAN TRỌNG: Thêm method này để hiển thị relation managers dưới dạng tabs
public function hasCombinedRelationManagerTabsWithContent(): bool
{
return true;// hiển thị relation managers trong TAB riêng thay vì inline (false là inline)
}
}
I did it thank you!

Again: Please format your code. It's hard to read this way.