Iliyas M
Iliyas M
FFilament
Created by Sidem on 11/28/2023 in #❓┊help
relation : How can i show the name and not the ID
Try this
Select::make('suivi_user_maintenance')
->relationship('suivipar', 'name',
function ($query, $state) {
$query
->where(fn ($q) => $q->where('statut', 1)
->with('role')
->whereHas('role', function ($q) {
$q->whereIn('name', ['S', 'RS', 'AF', 'AT']))
->when($state, fn ($q, $value) => $q->orWhere('id', $value));
})
->orderBy('name');
}
)
Select::make('suivi_user_maintenance')
->relationship('suivipar', 'name',
function ($query, $state) {
$query
->where(fn ($q) => $q->where('statut', 1)
->with('role')
->whereHas('role', function ($q) {
$q->whereIn('name', ['S', 'RS', 'AF', 'AT']))
->when($state, fn ($q, $value) => $q->orWhere('id', $value));
})
->orderBy('name');
}
)
6 replies
FFilament
Created by ndar on 7/27/2023 in #❓┊help
RelationManager Not working
Can u confirm ur RelationManager has getHeaderActions() with CreateAction in it?
4 replies
FFilament
Created by sijicc on 7/26/2023 in #❓┊help
validation messages under fields not showing
You may try this.
public function handle(array $company, string $path = ''): Company
{
$validated = Validator::make($company, [
$path.'name' => ['required', 'max:255'],
$path.'nip' => ['required', new NipRule(), 'unique:companies,nip'],
$path.'regon' => ['required', new RegonRule(), 'unique:companies,regon'],
$path.'krs' => ['max:10', 'nullable'],
$path.'website' => ['url', 'nullable'],
])->validate();

return Company::create($validated);
}
public function handle(array $company, string $path = ''): Company
{
$validated = Validator::make($company, [
$path.'name' => ['required', 'max:255'],
$path.'nip' => ['required', new NipRule(), 'unique:companies,nip'],
$path.'regon' => ['required', new RegonRule(), 'unique:companies,regon'],
$path.'krs' => ['max:10', 'nullable'],
$path.'website' => ['url', 'nullable'],
])->validate();

return Company::create($validated);
}
public function submit(\App\Actions\CreateCompany $createCompany): RedirectResponse|Redirector
{
$createCompany->handle($this->company, 'company.');

return redirect()->route('companies.index');
}
public function submit(\App\Actions\CreateCompany $createCompany): RedirectResponse|Redirector
{
$createCompany->handle($this->company, 'company.');

return redirect()->route('companies.index');
}
13 replies
FFilament
Created by sijicc on 7/26/2023 in #❓┊help
validation messages under fields not showing
13 replies
FFilament
Created by sijicc on 7/26/2023 in #❓┊help
validation messages under fields not showing
Why u validating separately? Just add related rules to each form fields. Filament will handle everything for u.
13 replies
FFilament
Created by Husky110 on 7/26/2023 in #❓┊help
Selfupdating Modal-Form
22 replies
FFilament
Created by Sanchit Patil on 7/26/2023 in #❓┊help
Load Schema / Reuse Schema
Put this in the resource class (like UserResource) as static function and reuse it anywhere by calling UserResource::getSchema()
19 replies
FFilament
Created by S.V Gubadov on 7/26/2023 in #❓┊help
Calculate the difference between 2 dates
Try this,
TextInput::make('total_of_days')
->disabled()
->formatStateUsing(fn(\Closure $get) => Carbon::parse($get('start_date'))->diffInDays(Carbon::parse($get('end_date'))))
->dehydrateUsing(fn(\Closure $get) => Carbon::parse($get('start_date'))->diffInDays(Carbon::parse($get('end_date'))))
->dehydrated(true)
->required(),
TextInput::make('total_of_days')
->disabled()
->formatStateUsing(fn(\Closure $get) => Carbon::parse($get('start_date'))->diffInDays(Carbon::parse($get('end_date'))))
->dehydrateUsing(fn(\Closure $get) => Carbon::parse($get('start_date'))->diffInDays(Carbon::parse($get('end_date'))))
->dehydrated(true)
->required(),
16 replies
FFilament
Created by S.V Gubadov on 7/26/2023 in #❓┊help
Calculate the difference between 2 dates
Can u confirm ur model has 'total_of_days' in $fillable?
16 replies
FFilament
Created by Scott on 7/26/2023 in #❓┊help
Primary Color for v3?
23 replies
FFilament
Created by Scott on 7/26/2023 in #❓┊help
Primary Color for v3?
In v3 configure your colors in the panel service provider.
23 replies
FFilament
Created by Scott on 7/26/2023 in #❓┊help
Primary Color for v3?
Are u using v3?
23 replies
FFilament
Created by Scott on 7/26/2023 in #❓┊help
Primary Color for v3?
If u do this , filament itself generates palate for your hex color
23 replies
FFilament
Created by Scott on 7/26/2023 in #❓┊help
Primary Color for v3?
This is enough i think. 'primary' => Color::hex('#694398'),
23 replies
FFilament
Created by Aaron Lawrence on 7/26/2023 in #❓┊help
RelationshipManager Table Actions.
Override isReadOnly() in the Relation Manager to return false.
5 replies
FFilament
Created by yeonjih on 7/26/2023 in #❓┊help
Get the sum of 2 values.
If u share ur form schema here, then it will be easy to give a quick solution.
9 replies
FFilament
Created by Gaspar on 7/6/2023 in #❓┊help
Best way to format data in the table
Have u tried this?
Tables\Columns\TextColumn::make('price')->money('eur', 100)
Tables\Columns\TextColumn::make('price')->money('eur', 100)
29 replies
FFilament
Created by dyo on 7/18/2023 in #❓┊help
Disable editRecord in custom view column
Why are u using a separate custom view for this. U can achieve this in TextColumn itself.
TextColumn::make('field')->url('your url')
TextColumn::make('field')->url('your url')
12 replies
FFilament
Created by Emaz on 7/17/2023 in #❓┊help
Layout question - Grids and Columns on a Form
Like this
Fieldset::make('Bed Types')->schema([Grid::make(5)->schema([]), Grid::make(5)->schema([])])
Fieldset::make('Bed Types')->schema([Grid::make(5)->schema([]), Grid::make(5)->schema([])])
21 replies