filament/filament
v3.2.93
v10.48.16
v3.5.2
v8.2.12
When a column in the database is of type geometry, the Filament panel feature breaks (it's not possible to visualize the record).
When I fill the column with NULL value, it works fine, but when I fill it with the POINT value containing Latitude and Longitude, it stops working.
I expected to be able to visualize the record.
php82 artisan make:model Coleta --migration
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('coletas', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->geometry('geo')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('coletas');
}
};
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Coleta extends Model
{
use HasFactory;
protected $table = 'coletas';
protected $fillable = [
'id',
'name',
'geo'
];
}
$coleta = new \App\Models\Coleta();
$coleta->name = 'Test';
$coleta->geo = \Illuminate\Support\Facades\DB::raw('POINT(46.646748, 24.562727)');
$coleta->save();
php artisan make:filament-resource Coleta --generate
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\ColetaResource\Pages;
use App\Filament\Resources\ColetaResource\RelationManagers;
use App\Models\Coleta;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class ColetaResource extends Resource
{
protected static ?string $model = Coleta::class;
protected static ?string $navigationIcon = 'heroicon-o-chevron-double-right';
protected static ?string $navigationLabel = 'Coletas';
protected static ?string $navigationGroup = 'Reciclagem';
protected static ?string $modelLabel = 'Coleta';
protected static ?string $pluralModelLabel = 'Coletas';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name')
->label('Name')
->required(),
])->columns(1);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('id')
->label("#")
->sortable(),
Tables\Columns\TextColumn::make('name')
->label('name'),
Tables\Columns\TextColumn::make('created_at')
->label("Criado em")
->dateTime("d/m/Y H:i:s")
->sortable()
->toggleable(isToggledHiddenByDefault: false),
Tables\Columns\TextColumn::make('updated_at')
->label("Atualizado em")
->dateTime("d/m/Y H:i:s")
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
->filters([
//
])
->actions([
Tables\Actions\ActionGroup::make([
Tables\Actions\ViewAction::make(),
Tables\Actions\EditAction::make(),
//Tables\Actions\DeleteAction::make(),
]),
])
->bulkActions([
/*Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),*/]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListColetas::route('/'),
'create' => Pages\CreateColeta::route('/create'),
'edit' => Pages\EditColeta::route('/{record}/edit'),
];
}
}
https://github.com/matheusjohannaraujo/bug-template-laravel-filament/
No error appears in laravel.log
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too