vahnmarty
vahnmarty
FFilament
Created by vahnmarty on 5/7/2024 in #❓┊help
Is there an easy way to transform all labels to a different format instead of ucfirst (default) ?
I'm talking about everything that Filament has, from Panels to Forms to Tables. I've been using ->label() a lot because I prefer to have a Str::title() .
5 replies
FFilament
Created by vahnmarty on 4/11/2024 in #❓┊help
How to implement novalidate on Action (modal) ?
In vendor/filament/tables/resources/views/index.blade.php,
<form wire:submit.prevent="callMountedTableAction">
@php
$action = $getMountedAction();
@endphp
<form wire:submit.prevent="callMountedTableAction">
@php
$action = $getMountedAction();
@endphp
What's the way to add novalidate in the form tag?
2 replies
FFilament
Created by vahnmarty on 3/21/2024 in #❓┊help
Unable to upload images more than 2MB.
No description
3 replies
FFilament
Created by vahnmarty on 3/21/2024 in #❓┊help
sortable() in second-level relationship
Currently, this resource is using ApplicationStatus model.
Tables\Columns\TextColumn::make("application.student.first_name")
->label("Student First Name")
->searchable()
->sortable(query: function (Builder $query, string $direction): Builder {
return $query->whereHas('application.student', function($sQuery) use ($direction) {
return $sQuery->orderBy('first_name', $direction);
});
}),
Tables\Columns\TextColumn::make("application.student.first_name")
->label("Student First Name")
->searchable()
->sortable(query: function (Builder $query, string $direction): Builder {
return $query->whereHas('application.student', function($sQuery) use ($direction) {
return $sQuery->orderBy('first_name', $direction);
});
}),
Since the default sortable() is not working, so I had to customize the query to it. However, the one I made is not working.
3 replies
FFilament
Created by vahnmarty on 2/26/2024 in #❓┊help
Apply changes to field's sibling from Repeater
Using a column called is_primary_contact to a Parent model, I want to use $set() to apply changes to all of the parents. There can be only 1 primary contact, so If I set the parent1 to is_primary_contact, the rest of the parents should be false.
Select::make('is_primary_contact')
->label('Is this parent the Primary Contact? (Only 1 parent can be the Primary Contact)')
->options([
1 => 'Yes',
0 => 'No'
])
->required()
->reactive()
->afterStateUpdated(function(Closure $get, Closure $set, $state){

if($state == 1)
{
$parentsRepeater = $get('../../parents');

foreach($parentsRepeater as $repeaterItemUuid => $parentItem)
{
// How??
}
}

$this->autoSaveParent($get('id'),'is_primary_contact', $state);
}),
Select::make('is_primary_contact')
->label('Is this parent the Primary Contact? (Only 1 parent can be the Primary Contact)')
->options([
1 => 'Yes',
0 => 'No'
])
->required()
->reactive()
->afterStateUpdated(function(Closure $get, Closure $set, $state){

if($state == 1)
{
$parentsRepeater = $get('../../parents');

foreach($parentsRepeater as $repeaterItemUuid => $parentItem)
{
// How??
}
}

$this->autoSaveParent($get('id'),'is_primary_contact', $state);
}),
3 replies
FFilament
Created by vahnmarty on 2/13/2024 in #❓┊help
How to align TextInput to the right side?
No description
3 replies
FFilament
Created by vahnmarty on 9/19/2023 in #❓┊help
How to easily change the placeholder text on Search?
I want every resource will have different search placeholder, for example in Child Resource, the placeholder should be "Search First Name, Email or Phone Number". In Application Resource "Search Control Number, Status, Name".
10 replies
FFilament
Created by vahnmarty on 9/3/2023 in #❓┊help
Prevent Logout when changing Admin Password
I created a Page called Change Password, and the form is just this:
<?php

namespace App\Filament\Pages;

use Auth;
use Filament\Pages\Page;
use Filament\Facades\Filament;
use Illuminate\Support\HtmlString;
use Filament\Forms\Components\Grid;
use Filament\Forms\Contracts\HasForms;
use Filament\Notifications\Notification;
use Filament\Forms\Components\Placeholder;
use Phpsa\FilamentPasswordReveal\Password;
use App\Notifications\Admin\PasswordUpdated;
use Illuminate\Validation\ValidationException;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Http\Responses\Auth\Contracts\LoginResponse;

class ChangePassword extends Page implements HasForms
{
use InteractsWithForms;

protected static ?string $navigationGroup = 'Settings';

protected static ?string $navigationIcon = 'heroicon-o-key';

protected static string $view = 'filament.pages.change-password';

public $password, $password_confirmation;

protected function getFormSchema() : array
{
return [
Password::make('password')
->label('New Password')
->revealable()
->minLength(8)
->maxLength(16)
->required()
->confirmed(),
Password::make('password_confirmation')
->label('Confirm Password')
->revealable()
->required()
];
}

public function update()
{
$data = $this->form->getState();

$user = Auth::user();
$user->password = $data['password'];
$user->save();

$user->notify(new PasswordUpdated);

return redirect('admin');
}
}
<?php

namespace App\Filament\Pages;

use Auth;
use Filament\Pages\Page;
use Filament\Facades\Filament;
use Illuminate\Support\HtmlString;
use Filament\Forms\Components\Grid;
use Filament\Forms\Contracts\HasForms;
use Filament\Notifications\Notification;
use Filament\Forms\Components\Placeholder;
use Phpsa\FilamentPasswordReveal\Password;
use App\Notifications\Admin\PasswordUpdated;
use Illuminate\Validation\ValidationException;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Http\Responses\Auth\Contracts\LoginResponse;

class ChangePassword extends Page implements HasForms
{
use InteractsWithForms;

protected static ?string $navigationGroup = 'Settings';

protected static ?string $navigationIcon = 'heroicon-o-key';

protected static string $view = 'filament.pages.change-password';

public $password, $password_confirmation;

protected function getFormSchema() : array
{
return [
Password::make('password')
->label('New Password')
->revealable()
->minLength(8)
->maxLength(16)
->required()
->confirmed(),
Password::make('password_confirmation')
->label('Confirm Password')
->revealable()
->required()
];
}

public function update()
{
$data = $this->form->getState();

$user = Auth::user();
$user->password = $data['password'];
$user->save();

$user->notify(new PasswordUpdated);

return redirect('admin');
}
}
Also, Everytime I hit submit form, it redirects to /login and not /admin/login.
5 replies
FFilament
Created by vahnmarty on 8/30/2023 in #❓┊help
Filament v3 - Vite Issue
I installed Filament, and also the filament/forms And I got this error after running npm run dev
[vite] Internal server error: Failed to load PostCSS config (searchPath: /Users/vahnmarty/Projects/myproj): [SyntaxError] Unexpected token 'export'
/Users/vahnmarty/Projects/myproj/postcss.config.js:1
export default {
^^^^^^

SyntaxError: Unexpected token 'export'
[vite] Internal server error: Failed to load PostCSS config (searchPath: /Users/vahnmarty/Projects/myproj): [SyntaxError] Unexpected token 'export'
/Users/vahnmarty/Projects/myproj/postcss.config.js:1
export default {
^^^^^^

SyntaxError: Unexpected token 'export'
20 replies
FFilament
Created by vahnmarty on 8/3/2023 in #❓┊help
How to customize repeater delete Item?
When using repeater::deleteItem on a certain Repeater, suddenly it affects to other Repeater. I have repeater for parents, children, activities. Everytime I delete an item from activities, a notification from Parent Repeater triggers.
Repeater::make('parents')
->registerListeners([
'repeater::deleteItem' => [
function (Component $component, string $statePath, string $uuidToDelete): void {
....
if() {

}else{
Notification::make()
->title('Unable to delete this parent')
->body('The application must have at least 1 parent.')
->danger()
->send();
}
}
]
])
Repeater::make('parents')
->registerListeners([
'repeater::deleteItem' => [
function (Component $component, string $statePath, string $uuidToDelete): void {
....
if() {

}else{
Notification::make()
->title('Unable to delete this parent')
->body('The application must have at least 1 parent.')
->danger()
->send();
}
}
]
])
2 replies
FFilament
Created by vahnmarty on 8/3/2023 in #❓┊help
Select::searchable not sorting alphabetically
4 replies
FFilament
Created by vahnmarty on 8/1/2023 in #❓┊help
HTML for getTableEmptyStateDescription
How to put html string when empty state?
14 replies
FFilament
Created by vahnmarty on 7/27/2023 in #❓┊help
Prevent Toggle to blink colors (see video).
I have an auto-save feature so, most of my inputs are using ->afterStateUpdated(). And I notice that every time I click/fill-up input, the toggles and checkboxes does this.
1 replies
FFilament
Created by vahnmarty on 7/26/2023 in #❓┊help
putting asterisk (*) on the left side.
In a required field, What's the easiest way to put the asterisk on the left side instead of the right side?
24 replies
FFilament
Created by vahnmarty on 7/24/2023 in #❓┊help
Delete items in FileUpload
How to delete files from FileUpload without hitting the submit or using $this->form->getState()? How to trigger a delete item too, like is there a '->afterFileDeleted? ->afterStateUpdated doesn't trigger when deleting items from a FileUpload::multiple
2 replies
FFilament
Created by vahnmarty on 7/20/2023 in #❓┊help
modalSubheading is not working?
4 replies
FFilament
Created by vahnmarty on 7/20/2023 in #❓┊help
Fix Table responsiveness
5 replies
FFilament
Created by vahnmarty on 7/18/2023 in #❓┊help
How to validate Checkbox using required()?
Checkbox::make('has_agreed')
->reactive()
->required(),
Checkbox::make('has_agreed')
->reactive()
->required(),
Upon hitting the submit button, the checkbox does not show an error message. Note that I'm using novalidate to my <form>
4 replies
FFilament
Created by vahnmarty on 7/16/2023 in #❓┊help
How to close datepicker once the user clicks a date?
The only way to close the datepicker is by clicking outside the calendar.
5 replies
FFilament
Created by vahnmarty on 7/15/2023 in #❓┊help
How to modify ToggleColumn function?
It's amazing how ToggleColumn can update to the backend, but I'm curious about how to customize that. I have a column is_primary. Once I toggled a row, the other rows is_primary must be toggled too. So if I set the is_primary to true, the other rows is_primary will be false.
ToggleColumn::make('is_primary')
ToggleColumn::make('is_primary')
7 replies