Craig Potter
Craig Potter
FFilament
Created by Craig Potter on 10/11/2024 in #❓┊help
Whats the best way to use Filament Tables in a Custom Package
Yeah I did think of that. Using Spatie Package Tools and it has an install command built in. Might have to look and see if you can manually call artisan commands or something 🤔
7 replies
FFilament
Created by Craig Potter on 10/11/2024 in #❓┊help
Whats the best way to use Filament Tables in a Custom Package
😦 was hoping for another way. asking them to add filament:update to their post-autoload seems lame but maybe it's the only way 🤔
7 replies
FFilament
Created by jeph on 2/9/2024 in #❓┊help
two columns from a single database column
Sorry I mis-read this as TextInput 🙂 Thought it was a form input. Can't you use an accessor on your model for this ? How about
// App/Models/Customer

protected function firstName(): Attribute
{
return Attribute::make(
get: fn (string $value) => Str::of($this->name)->split('/[\s]+/')->first() ?? '',
);
}

protected function lastName(): Attribute
{
return Attribute::make(
get: fn (string $value) => Str::of($this->name)->split('/[\s]+/')->last() ?? '',
);
}

// Your Table

TextColumn::make('first_name'),

TextColumn::make('last_name'),
// App/Models/Customer

protected function firstName(): Attribute
{
return Attribute::make(
get: fn (string $value) => Str::of($this->name)->split('/[\s]+/')->first() ?? '',
);
}

protected function lastName(): Attribute
{
return Attribute::make(
get: fn (string $value) => Str::of($this->name)->split('/[\s]+/')->last() ?? '',
);
}

// Your Table

TextColumn::make('first_name'),

TextColumn::make('last_name'),
6 replies
FFilament
Created by jeph on 2/9/2024 in #❓┊help
two columns from a single database column
Have you tried ->id()
TextColumn::make('name')
->formatStateUsing(function ($state) {
$names = explode(' ', $state); // Split the full name into an array
return $names[0]; // First name
})
->label('First Name')
->id('first_name'),

TextColumn::make('name')
->formatStateUsing(function ($state) {
$names = explode(' ', $state); // Split the full name into an array
return $names[1] ?? ''; // Last name (or empty string if not available)
})
->label('Last Name')
->id('last_name'),
TextColumn::make('name')
->formatStateUsing(function ($state) {
$names = explode(' ', $state); // Split the full name into an array
return $names[0]; // First name
})
->label('First Name')
->id('first_name'),

TextColumn::make('name')
->formatStateUsing(function ($state) {
$names = explode(' ', $state); // Split the full name into an array
return $names[1] ?? ''; // Last name (or empty string if not available)
})
->label('Last Name')
->id('last_name'),
6 replies
FFilament
Created by Craig Potter on 10/13/2023 in #❓┊help
Pasting in to a tagsInput splits a string
Looks like it was already reported and fixed - https://github.com/filamentphp/filament/issues/9313
8 replies
FFilament
Created by Craig Potter on 10/13/2023 in #❓┊help
Pasting in to a tagsInput splits a string
Hahaha sorry @awcodes only just saw your reply. I will try and report it on GH later today. I did find a semi-work around however for anyone experiencing the same issue. @carloscapote If you add ->splitKeys([' ']) it appears to work e.g.
TagsInput::make('test')->splitKeys([' '])
TagsInput::make('test')->splitKeys([' '])
This wouldn't work if you have spaces in your tags but for single word tags it appears to work for now.
8 replies
FFilament
Created by Craig Potter on 10/6/2023 in #❓┊help
TagsInput Validation on Custom Livewire Component
This has now been fixed in core
3 replies
FFilament
Created by Craig Potter on 4/13/2023 in #❓┊help
Repeater on a simple json column
🫶
5 replies
FFilament
Created by Craig Potter on 3/23/2023 in #❓┊help
How to use current Login
🤦‍♂️ Thanks Dan, that works 😄
13 replies
FFilament
Created by Craig Potter on 3/23/2023 in #❓┊help
How to use current Login
Nope because I guess the filament routes are being registered after the laravel routes so doing something like
Route::redirect('/admin/login', '/login');
Route::redirect('/admin/login', '/login');
doesn't work because it is overwritten.
13 replies
FFilament
Created by Craig Potter on 3/23/2023 in #❓┊help
How to use current Login
Hmm not sure that will work.... Or not completely.... I think I will need to extend vendor/filament/filament/src/Http/Middleware/Authenticate.php and overwrite the protected function redirectTo($request) method. Need to make sure to use my custom Middleware in the filament config under auth as well 🙂
13 replies