mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
fix tests
This commit is contained in:
+3
-1
@@ -88,6 +88,8 @@ trait CanGenerateModelInfolists
|
||||
|
||||
$componentName = "{$guessedRelationshipName}.{$guessedRelationshipTitleColumnName}";
|
||||
}
|
||||
} else {
|
||||
$guessedRelationshipName = null;
|
||||
}
|
||||
|
||||
$componentData = [];
|
||||
@@ -134,7 +136,7 @@ trait CanGenerateModelInfolists
|
||||
'float',
|
||||
'double',
|
||||
'money',
|
||||
]) && blank($guessedRelationshipName ?? null)) {
|
||||
]) && blank($guessedRelationshipName)) {
|
||||
$componentData[in_array($componentName, [
|
||||
'cost',
|
||||
'money',
|
||||
|
||||
@@ -107,6 +107,8 @@ trait CanGenerateModelTables
|
||||
|
||||
$columnName = "{$guessedRelationshipName}.{$guessedRelationshipTitleColumnName}";
|
||||
}
|
||||
} else {
|
||||
$guessedRelationshipName = null;
|
||||
}
|
||||
|
||||
$columnData = [];
|
||||
@@ -132,10 +134,10 @@ trait CanGenerateModelTables
|
||||
default => TextColumn::class,
|
||||
};
|
||||
|
||||
if (in_array($type['name'], [
|
||||
if ((in_array($type['name'], [
|
||||
'string',
|
||||
'char',
|
||||
]) && ($columnData['type'] === TextColumn::class)) {
|
||||
]) && ($columnData['type'] === TextColumn::class)) || filled($guessedRelationshipName)) {
|
||||
$columnData['searchable'] = [];
|
||||
}
|
||||
|
||||
@@ -163,7 +165,7 @@ trait CanGenerateModelTables
|
||||
'float',
|
||||
'double',
|
||||
'money',
|
||||
]) && blank($guessedRelationshipName ?? null)) {
|
||||
]) && blank($guessedRelationshipName)) {
|
||||
$columnData[in_array($columnName, [
|
||||
'cost',
|
||||
'money',
|
||||
|
||||
+1
-2
@@ -53,8 +53,7 @@ class PostResource extends Resource
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('author.name')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
->searchable(),
|
||||
Tables\Columns\IconColumn::make('is_published')
|
||||
->boolean(),
|
||||
Tables\Columns\TextColumn::make('rating')
|
||||
|
||||
+2
-4
@@ -64,8 +64,7 @@ class PostResource extends Resource
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextEntry::make('author.name')
|
||||
->numeric(),
|
||||
TextEntry::make('author.name'),
|
||||
IconEntry::make('is_published')
|
||||
->boolean(),
|
||||
TextEntry::make('rating')
|
||||
@@ -86,8 +85,7 @@ class PostResource extends Resource
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('author.name')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
->searchable(),
|
||||
IconColumn::make('is_published')
|
||||
->boolean(),
|
||||
TextColumn::make('rating')
|
||||
|
||||
+1
-2
@@ -12,8 +12,7 @@ class PostInfolist
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextEntry::make('author.name')
|
||||
->numeric(),
|
||||
TextEntry::make('author.name'),
|
||||
IconEntry::make('is_published')
|
||||
->boolean(),
|
||||
TextEntry::make('rating')
|
||||
|
||||
+1
-2
@@ -16,8 +16,7 @@ class PostsTable
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('author.name')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
->searchable(),
|
||||
IconColumn::make('is_published')
|
||||
->boolean(),
|
||||
TextColumn::make('rating')
|
||||
|
||||
+1
-2
@@ -29,8 +29,7 @@ class ListPostsWithColumns extends Component implements HasActions, HasSchemas,
|
||||
->query(fn (): Builder => Post::query())
|
||||
->columns([
|
||||
TextColumn::make('author.name')
|
||||
->numeric()
|
||||
->sortable(),
|
||||
->searchable(),
|
||||
IconColumn::make('is_published')
|
||||
->boolean(),
|
||||
TextColumn::make('rating')
|
||||
|
||||
Reference in New Issue
Block a user