Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
markvaneijk committed Nov 19, 2024
1 parent ebc1fad commit f9791e1
Showing 1 changed file with 38 additions and 29 deletions.
67 changes: 38 additions & 29 deletions src/Resources/RedirectResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

namespace Vormkracht10\FilamentRedirects\Resources;

use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Tables;
use Filament\Forms\Form;
use Filament\Tables\Table;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Forms\Components\Tabs;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\Tabs\Tab;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Vormkracht10\FilamentRedirects\Resources\RedirectResource\Pages;
use Filament\Forms\Components\TextInput;
use Vormkracht10\Redirects\Models\Redirect;
use Vormkracht10\FilamentRedirects\Resources\RedirectResource\Pages;

class RedirectResource extends Resource
{
Expand Down Expand Up @@ -41,31 +43,38 @@ public static function form(Form $form): Form
{
return $form
->schema([
Select::make('code')
->label(__('Type'))
->columnSpanFull()
->native(false)
->options(collect(config('redirects.status_codes'))->map(fn (string $type, int $code) => $code . ' ' . $type))
->searchable()
->required()
->default(config('redirects.default_status_code'))
->prefixIcon('heroicon-o-map-pin')
->placeholder('HTTP status message'),
TextInput::make('source')
->label(__('Source'))
->url()
->columnSpanFull()
->required()
->prefixIcon('heroicon-o-arrow-uturn-right')
->placeholder(__('Type path, URL or pattern...'))
->helperText(__('The path to match, you can use regular expressions.')),
TextInput::make('destination')
->label(__('Destination'))
->url()
Tabs::make('Tabs')
->columnSpanFull()
->required()
->prefixIcon('heroicon-o-arrow-uturn-left')
->placeholder('Type path or URL...'),
->tabs([
Tab::make('Redirect')
->schema([
Select::make('code')
->label(__('Type'))
->columnSpanFull()
->native(false)
->options(collect(config('redirects.status_codes'))->map(fn(string $type, int $code) => $code . ' ' . $type))
->searchable()
->required()
->default(config('redirects.default_status_code'))
->prefixIcon('heroicon-o-map-pin')
->placeholder('HTTP status message'),
TextInput::make('source')
->label(__('Source'))
->url()
->columnSpanFull()
->required()
->prefixIcon('heroicon-o-arrow-uturn-right')
->placeholder(__('Type path, URL or pattern...'))
->helperText(__('The path to match, you can use regular expressions.')),
TextInput::make('destination')
->label(__('Destination'))
->url()
->columnSpanFull()
->required()
->prefixIcon('heroicon-o-arrow-uturn-left')
->placeholder('Type path or URL...'),
]),
]),
]);
}

Expand Down

0 comments on commit f9791e1

Please sign in to comment.