diff --git a/README.md b/README.md index 28d51d4..970317b 100644 --- a/README.md +++ b/README.md @@ -379,10 +379,38 @@ class NewsResource extends Resource { return $table ->columns([ - Tables\Columns\Layout\Panel::make([ - Tables\Columns\TextColumn::make('data') - ->getStateUsing(fn ($record) => $record->setVisible(['title', 'short_desc', 'description'])->toJson()), - ]), + + Tables\Columns\ColumnGroup::make('Data') + ->columns([ + Tables\Columns\TextColumn::make('title') + ->getStateUsing(fn ($record) => new HtmlString(collect($record->title) + ->map(fn ($state, $locale) => << +
$locale
+
$state
+ + Html) + ->implode(''))), + Tables\Columns\TextColumn::make('short_desc') + ->getStateUsing(fn ($record) => new HtmlString(collect($record->short_desc) + ->map(fn ($state, $locale) => << +
$locale
+
$state
+ + Html) + ->implode(''))), + Tables\Columns\TextColumn::make('description') + ->getStateUsing(fn ($record) => new HtmlString(collect($record->description) + ->map(fn ($state, $locale) => << +
$locale
+
$state
+ + Html) + ->implode(''))), + ]), + ]) ->actions([ Tables\Actions\EditAction::make(), Tables\Actions\DeleteAction::make(), @@ -407,6 +435,12 @@ class News extends Model public $translatable = ['title', 'short_desc', 'description']; + public $casts = [ + 'title' => 'json', + 'short_desc' => 'json', + 'description' => 'json', + ]; + // ... } ```