Rolland
Rolland
FFilament
Created by Rolland on 11/18/2024 in #❓┊help
No application encryption key has been specified
As the title suggests. Has anyone have this problem? I am wondering why this is occured. I have tried: php artisan clear php artisan optimize:clear php artisan filament:optimize-clear composer dump-autoload
5 replies
FFilament
Created by Rolland on 11/13/2024 in #❓┊help
Custom Column generator problem
3 replies
FFilament
Created by Rolland on 10/30/2024 in #❓┊help
Responsive Design Breakpoint Issue in Custom Component
I'm struggling with a responsive design issue for a custom component. The breakpoint prefix for responsiveness doesn't seem to work properly. Also, while the h-96 class works fine, switching to h-80 doesn't have any effect. Below is the component code:
@props(['request'])

<div class="p-4 grow">
<h2 class="font-medium text-gray-700 dark:text-gray-200">Item List</h2>
<div class="space-y-4 md:max-h-96 md:overflow-y-auto pt-2"> // this line "md:"
@foreach ($request->items as $item)
<x-conversation.request-modal.item-detail :item="$item" />
@endforeach
</div>
</div>
@props(['request'])

<div class="p-4 grow">
<h2 class="font-medium text-gray-700 dark:text-gray-200">Item List</h2>
<div class="space-y-4 md:max-h-96 md:overflow-y-auto pt-2"> // this line "md:"
@foreach ($request->items as $item)
<x-conversation.request-modal.item-detail :item="$item" />
@endforeach
</div>
</div>
Any ideas on why the breakpoint prefix isn't taking effect, or why h-80 doesn't work here?
5 replies
FFilament
Created by Rolland on 10/22/2024 in #❓┊help
Displaying prefill data in action form select with relationship
Tables\Actions\Action::make('assign_role')
->form([
Forms\Components\Select::make('roles.name')
->relationship('roles', 'name')
->multiple()
->searchable()
->preload()
->native(false)
->required()
])
->action(function () {
...
})
Tables\Actions\Action::make('assign_role')
->form([
Forms\Components\Select::make('roles.name')
->relationship('roles', 'name')
->multiple()
->searchable()
->preload()
->native(false)
->required()
])
->action(function () {
...
})
I am wondering if this possible or not.
6 replies
FFilament
Created by Rolland on 10/16/2024 in #❓┊help
Repeater with existing data
Forms\Components\Section::make('Request Items')
->schema([
Forms\Components\Repeater::make('requestHasItems')
->relationship()
->schema([
Forms\Components\Select::make('item_id')
->relationship('item', 'name')
->searchable()
->native(false)
->preload()
->required(),
Forms\Components\TextInput::make('quantity')
->numeric()
->default(1)
->required(),
])
->columns(2),
]),
Forms\Components\Section::make('Request Items')
->schema([
Forms\Components\Repeater::make('requestHasItems')
->relationship()
->schema([
Forms\Components\Select::make('item_id')
->relationship('item', 'name')
->searchable()
->native(false)
->preload()
->required(),
Forms\Components\TextInput::make('quantity')
->numeric()
->default(1)
->required(),
])
->columns(2),
]),
I have this repeater to add items to a request. I can add the items to the request_has_items table, but I don't know how to display them in the repeater. I kindly need some guidance.
4 replies
FFilament
Created by Rolland on 10/10/2024 in #❓┊help
Interact with Pivot attributes in Relation Manager
Tables\Columns\ToggleColumn::make('is_active')
->label(__('department.attributes.is_active'))
->onIcon('heroicon-o-eye')
->offIcon('heroicon-o-eye-slash')
Tables\Columns\ToggleColumn::make('is_active')
->label(__('department.attributes.is_active'))
->onIcon('heroicon-o-eye')
->offIcon('heroicon-o-eye-slash')
I wanted to update the is_active but it is not updating. not sure what i did wrong here. Department model:
public function userHasDepartments(): BelongsToMany
{
return $this->belongsToMany(User::class, 'user_has_department')
->withPivot(['is_active'])
->withTimestamps();
}
public function userHasDepartments(): BelongsToMany
{
return $this->belongsToMany(User::class, 'user_has_department')
->withPivot(['is_active'])
->withTimestamps();
}
4 replies
FFilament
Created by Rolland on 10/4/2024 in #❓┊help
Timer on a Form
Is it possible to add a timer and then kick the user out of the form if the time passed that timer?
5 replies
FFilament
Created by Rolland on 9/24/2024 in #❓┊help
Grid not applying to Section
No description
5 replies
FFilament
Created by Rolland on 9/18/2024 in #❓┊help
modify requiresConfirmation width
No description
6 replies
FFilament
Created by Rolland on 9/12/2024 in #❓┊help
How to render SVG file on HTMLString
class LeaveApprovalStatsOverview extends BaseWidget
{
....

private function createDescription(LeaveStatus $firstStatus, LeaveStatus $secondStatus): HtmlString
{
return new HtmlString(
view('components.leave-status-description', compact('firstStatus', 'secondStatus'))->render()
);
}

private function createLabel(int $first, int $second): HtmlString
{
return new HtmlString(
view('components.leave-count-label', compact('first', 'second'))->render()
);
}
}
class LeaveApprovalStatsOverview extends BaseWidget
{
....

private function createDescription(LeaveStatus $firstStatus, LeaveStatus $secondStatus): HtmlString
{
return new HtmlString(
view('components.leave-status-description', compact('firstStatus', 'secondStatus'))->render()
);
}

private function createLabel(int $first, int $second): HtmlString
{
return new HtmlString(
view('components.leave-count-label', compact('first', 'second'))->render()
);
}
}
leave-status-description:
<div class='flex'>
<div class='flex justify-center' style='color: {{ $firstStatus->getColorHex() }};'>
<span>
{{ $firstStatus->getLabel() }}
</span>
<span>
{{ $firstStatus->getIconSvg() }}
</span>
</div>
<span class='px-1'>/</span>
<div class='flex justify-center' style='color: {{ $secondStatus->getColorHex() }};'>
<span>
{{ $secondStatus->getLabel() }}
</span>
<span>
{{ $secondStatus->getIconSvg() }}
</span>
</div>
</div>
<div class='flex'>
<div class='flex justify-center' style='color: {{ $firstStatus->getColorHex() }};'>
<span>
{{ $firstStatus->getLabel() }}
</span>
<span>
{{ $firstStatus->getIconSvg() }}
</span>
</div>
<span class='px-1'>/</span>
<div class='flex justify-center' style='color: {{ $secondStatus->getColorHex() }};'>
<span>
{{ $secondStatus->getLabel() }}
</span>
<span>
{{ $secondStatus->getIconSvg() }}
</span>
</div>
</div>
leave-count-label:
<div class='flex space-x-2'>
<span>{{ $first }}</span>
<span class='px-1'>/</span>
<span>{{ $second }}</span>
</div>
<div class='flex space-x-2'>
<span>{{ $first }}</span>
<span class='px-1'>/</span>
<span>{{ $second }}</span>
</div>
6 replies
FFilament
Created by Rolland on 9/12/2024 in #❓┊help
Hi, does anyone know how to add a break-line in StatsOverview Widget?
in the ->description()
Stat::make('User Analytics', $totalUsers)
->description(
<<<HTML
Active: $activeUsers ({$this->getActivePercentage($activeUsers, $totalUsers)}%)<br>
Inactive: $inactiveUsers ({$this->getInactivePercentage($inactiveUsers, $totalUsers)}%)
HTML
)
->descriptionIcon('heroicon-m-users')
->chart($userGrowth->pluck('aggregate')->toArray())
->color('primary'),
Stat::make('User Analytics', $totalUsers)
->description(
<<<HTML
Active: $activeUsers ({$this->getActivePercentage($activeUsers, $totalUsers)}%)<br>
Inactive: $inactiveUsers ({$this->getInactivePercentage($inactiveUsers, $totalUsers)}%)
HTML
)
->descriptionIcon('heroicon-m-users')
->chart($userGrowth->pluck('aggregate')->toArray())
->color('primary'),
6 replies
FFilament
Created by Rolland on 9/11/2024 in #❓┊help
How to organise/sort the widgets in Dashboard?
as title suggests
4 replies
FFilament
Created by Rolland on 9/6/2024 in #❓┊help
how to trigger notification on a custom bulkaction?
Tables\Actions\BulkAction::make('toggleStatus')
->label('Toggle Status')
->icon('heroicon-o-arrow-path')
->requiresConfirmation()
->action(function (Collection $records) {
$records->each(function (User $user) {
$user->update(['is_active' => !$user->is_active]);
});
})
->deselectRecordsAfterCompletion()
->successNotification(
Notification::make()
->success()
->title('User status updated')
->body('The selected users\' statuses have been toggled.')
),
Tables\Actions\BulkAction::make('toggleStatus')
->label('Toggle Status')
->icon('heroicon-o-arrow-path')
->requiresConfirmation()
->action(function (Collection $records) {
$records->each(function (User $user) {
$user->update(['is_active' => !$user->is_active]);
});
})
->deselectRecordsAfterCompletion()
->successNotification(
Notification::make()
->success()
->title('User status updated')
->body('The selected users\' statuses have been toggled.')
),
5 replies
FFilament
Created by Rolland on 8/13/2024 in #❓┊help
Form select not updating options data
so i was creating color from inside a Select components using createOptionForm(), I am expecting the data to return with the new created color, but its not returning it. code
Forms\Components\Select::make('color_id')
->label(__('vehicle.attributes.color_id'))
->placeholder(__('vehicle.placeholders.color_id'))
->native(false)
->searchable()
->options(
VehicleInfo\Color::all()->mapWithKeys(fn ($color) => [
$color->id => "<span class='flex items-center gap-x-4'>
<span class='rounded-full w-4 h-4' style='background-color: {$color->color};'></span>
<span>{$color->name}</span>
</span>",
])
)
->reactive()
->createOptionForm([
Forms\Components\TextInput::make('name')
->required(),
Forms\Components\ColorPicker::make('color')
->required(),
])
->createOptionUsing(function (array $data) {
$color = VehicleInfo\Color::create($data);

return $color->id;
})
->allowHtml()
->required(),
Forms\Components\Select::make('color_id')
->label(__('vehicle.attributes.color_id'))
->placeholder(__('vehicle.placeholders.color_id'))
->native(false)
->searchable()
->options(
VehicleInfo\Color::all()->mapWithKeys(fn ($color) => [
$color->id => "<span class='flex items-center gap-x-4'>
<span class='rounded-full w-4 h-4' style='background-color: {$color->color};'></span>
<span>{$color->name}</span>
</span>",
])
)
->reactive()
->createOptionForm([
Forms\Components\TextInput::make('name')
->required(),
Forms\Components\ColorPicker::make('color')
->required(),
])
->createOptionUsing(function (array $data) {
$color = VehicleInfo\Color::create($data);

return $color->id;
})
->allowHtml()
->required(),
6 replies
FFilament
Created by Rolland on 8/5/2024 in #❓┊help
conditioning using activeTab not working as expected
No description
4 replies
FFilament
Created by Rolland on 7/26/2024 in #❓┊help
Creating a test for ToggleColumn
No description
14 replies
FFilament
Created by Rolland on 7/17/2024 in #❓┊help
Is it possible to have multiple models in one table?
.
9 replies
FFilament
Created by Rolland on 6/28/2024 in #❓┊help
How to deal with nested item for UI on a tab?
No description
6 replies
FFilament
Created by Rolland on 6/21/2024 in #❓┊help
how to disable footer actions on a Modal?
No description
7 replies
FFilament
Created by Rolland on 5/23/2024 in #❓┊help
Notification Not Showing!
I am implementing custom notification on a custom action button. Here is the code
Forms\Components\Section::make('Import From Box')
->headerActions([
Forms\Components\Actions\Action::make('Fetch')
->action(fn (BoxApi $boxApi, Forms\Set $set, ?array $state) => static::fetchBoxApi($boxApi, $set, $state))
->failureNotification(static::createNotification(
'Value Not Found!', 'Please make sure its a valid URL!'
))
->successNotification(static::createNotification(
'Successful', 'Value Has been Imported!'
)),
])
->schema([
...
])->columns(2),
Forms\Components\Section::make('Import From Box')
->headerActions([
Forms\Components\Actions\Action::make('Fetch')
->action(fn (BoxApi $boxApi, Forms\Set $set, ?array $state) => static::fetchBoxApi($boxApi, $set, $state))
->failureNotification(static::createNotification(
'Value Not Found!', 'Please make sure its a valid URL!'
))
->successNotification(static::createNotification(
'Successful', 'Value Has been Imported!'
)),
])
->schema([
...
])->columns(2),
private static function createNotification(string $title, string $body): Notification
{
return Notification::make()
->danger()
->title($title)
->body($body);
}
private static function createNotification(string $title, string $body): Notification
{
return Notification::make()
->danger()
->title($title)
->body($body);
}
I have set for failure and success notification like this
->failureNotification(static::createNotification(
'Value Not Found!', 'Please make sure its a valid URL!'
))
->successNotification(static::createNotification(
'Successful', 'Value Has been Imported!'
)),
->failureNotification(static::createNotification(
'Value Not Found!', 'Please make sure its a valid URL!'
))
->successNotification(static::createNotification(
'Successful', 'Value Has been Imported!'
)),
and still there's no notification poping up.
5 replies