PHP code example of swisnl / filament-geometry

1. Go to this page and download the library: Download swisnl/filament-geometry library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

swisnl / filament-geometry example snippets


use Swis\Filament\Geometry\Enums\DrawMode;
use Swis\Filament\Geometry\Forms\Geometry;
...
->schema[
    ...
    Geometry::make('location')
        ->drawModes([
            DrawMode::Marker,
            DrawMode::Polygon,
            DrawMode::Polyline,
            DrawMode::Rectangle,
        ]),
    ...
]

use Swis\Filament\Geometry\Enums\ControlPosition;
use Swis\Filament\Geometry\Enums\DrawMode;
use Swis\Filament\Geometry\Forms\Geometry;
use Swis\Filament\Geometry\Icons\Marker;
use Swis\Filament\Geometry\TileLayers\Carto;

...

Geometry::make('location')
    ->label(__('Location'))

    // Map configuration
    ->maxZoom(16)
    ->minZoom(4)
    ->center(52.164206390898904, 4.491920969490259)
    ->zoom(15)
    ->boundaries(true, 49.5, -11, 61, 2) // Example for British Isles
    ->tileLayer(Carto::make())

    // Marker configuration
    ->markerIcon(Marker::make('#3b82f6'))
    
    // Controls
    ->showFullscreenControl(true)
    ->showZoomControl(true)
    ->showAttributionControl(true)
    ->drawModes([
        DrawMode::Polygon,
        DrawMode::Rectangle,
    ])
    ->drawControlPosition(ControlPosition::TopRight)
js
content: [
    '<path-to-vendor>/swisnl/filament-geometry/**/*.blade.php',
]