N1XN
N1XN
FFilament
Created by N1XN on 11/6/2023 in #❓┊help
Column headers using Split
Ok thanks anyway @toeknee
4 replies
FFilament
Created by N1XN on 10/21/2023 in #❓┊help
Save prefix values
Some magic is happening behind the scenes I did not understood, so my workaround is: remove ->reactive() and set the value directly after update using ->afterStateUpdated(fn ($state, callable $set) => $set('code', Party::find($state)->code.'-'))
4 replies
FFilament
Created by N1XN on 9/30/2023 in #❓┊help
Disable auth (cache)
/config/filament.php
'auth' => [
'guard' => env('FILAMENT_AUTH_GUARD', 'web'),
'pages' => [
'login' => [\App\Http\Controllers\Auth\AuthenticatedSessionController::class, 'create'],
],
],
'auth' => [
'guard' => env('FILAMENT_AUTH_GUARD', 'web'),
'pages' => [
'login' => [\App\Http\Controllers\Auth\AuthenticatedSessionController::class, 'create'],
],
],
4 replies
FFilament
Created by N1XN on 9/29/2023 in #❓┊help
S3 visibility
yes I did, as the upload works as expected.
16 replies
FFilament
Created by N1XN on 9/29/2023 in #❓┊help
S3 visibility
no errors sir!
16 replies
FFilament
Created by N1XN on 9/29/2023 in #❓┊help
S3 visibility
Ok from my point of view this is again a global solution, applied to the disc config instead of the media library config...
16 replies
FFilament
Created by N1XN on 9/29/2023 in #❓┊help
S3 visibility
I don't have to apply this command as I am only using the default disk. It is set to do which represents digital ocean spaces in my system - which is afaik s3
16 replies
FFilament
Created by N1XN on 9/29/2023 in #❓┊help
S3 visibility
Oh ok thats a pitty, is there a way I can set those custom headers per file basis?
16 replies
FFilament
Created by N1XN on 9/29/2023 in #❓┊help
S3 visibility
@DrByte I was expecting that it sets the ACL Headers accordingly. I can successfully set the permissions globally via /config/media-library.php and remote.extra_headers by adding 'ACL' => 'public-read' but that is globally.
16 replies
FFilament
Created by N1XN on 9/29/2023 in #❓┊help
Unable to retrieve the mime_type for file at location: livewire-tmp/kHGEXYiSJSh3w2av6KCn8cYKvfexf6-m
its because minio is not fully compatible running inside docker and serving outside http
4 replies
FFilament
Created by Son of Andy on 8/3/2023 in #❓┊help
Spatie Media Library File Upload::getUploadedFileUsing does not exist.
Thanks @IT-percy
6 replies
FFilament
Created by N1XN on 8/28/2023 in #❓┊help
Access nested sum
I am not sure, because I solved this - but I think this way I would loose sorting, or would have to implement it manually. I fixed it by defining the needed relationship inside the model, so I don't have to traverse. https://github.com/staudenmeir/eloquent-has-many-deep
9 replies
FFilament
Created by N1XN on 8/28/2023 in #❓┊help
Access nested sum
The Hospital has a relation to Patients through Doctors (HasManyThrough). So I actually can sum other columns that are in the patient table already. But going one more deep is kind of not working.
9 replies
FFilament
Created by N1XN on 8/28/2023 in #❓┊help
Access nested sum
@Dennis Koch unfortunately not. Maybe some information are missing from my side. Hospital ->hasMany -> Doctor -> hasMany -> Patient -> hasMany PatientProtocol I want from the HospitalResource to sum all doses.
9 replies
FFilament
Created by N1XN on 8/27/2023 in #❓┊help
RelationManager attempts to lazy load relations
I have done this in DoctorResource @AlexAnder but still getting lazy loading error.
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()->with([
'patients.latestPatientMediaction.minDose',
'patients.latestPatientMediaction.maxDose']);
}
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()->with([
'patients.latestPatientMediaction.minDose',
'patients.latestPatientMediaction.maxDose']);
}
Contrary this call works without ever setting the with in the query.
TextColumn::make('latestPatientMediaction.minDose.name')
->label('min. dose')
->sortable(),
TextColumn::make('latestPatientMediaction.maxDose.name')
->label('max. dose')
->sortable(),
TextColumn::make('latestPatientMediaction.minDose.name')
->label('min. dose')
->sortable(),
TextColumn::make('latestPatientMediaction.maxDose.name')
->label('max. dose')
->sortable(),
3 replies
FFilament
Created by N1XN on 8/26/2023 in #❓┊help
Sum latest HasThroughMany
Figured it out but, filament now completely ignores the subquery and returns the sum of all protocols.... Seems like a bug
public function latestPatientProtocols(): HasManyThrough
{
$subquery = PatientProtocol::select('patient_id')
->selectSub('MAX(id)', 'max_id')
->groupBy('patient_id');

return $this->hasManyThrough(
PatientProtocol::class,
Patient::class
)->joinSub($subquery, 'latest_protocols', function ($join) {
$join->on('patient_protocols.id', '=', 'latest_protocols.max_id');
});
}
public function latestPatientProtocols(): HasManyThrough
{
$subquery = PatientProtocol::select('patient_id')
->selectSub('MAX(id)', 'max_id')
->groupBy('patient_id');

return $this->hasManyThrough(
PatientProtocol::class,
Patient::class
)->joinSub($subquery, 'latest_protocols', function ($join) {
$join->on('patient_protocols.id', '=', 'latest_protocols.max_id');
});
}
TextColumn::make('latest_patient_protocols_sum_metric_value')
->sum('latestPatientProtocols', 'metric_value')
->label('Patient Metric')
->suffix(' units'),
TextColumn::make('latest_patient_protocols_sum_metric_value')
->sum('latestPatientProtocols', 'metric_value')
->label('Patient Metric')
->suffix(' units'),
4 replies
FFilament
Created by Stevee on 8/25/2023 in #❓┊help
Filament Spatie Translatable Plugin for relation model
I am also interested in this as I currently have to do this:
Select::make('unit_id')
->relationship('unit', 'name->de') // kinda sucks
->label('Einheit')
->reactive()
->required(),
Select::make('unit_id')
->relationship('unit', 'name->de') // kinda sucks
->label('Einheit')
->reactive()
->required(),
10 replies
FFilament
Created by H.Bilbao on 8/23/2023 in #❓┊help
Dependant select with multiple options
Oh great! Thanks for this detailed explanation!
10 replies
FFilament
Created by H.Bilbao on 8/23/2023 in #❓┊help
Dependant select with multiple options
Try removing 'name:' and 'titleAttribute:' inside relationships() function. It should be ->relationships('nations', 'name') Ultimately you want MorphToSelect https://filamentphp.com/docs/3.x/forms/fields/select#handling-morphto-relationships
10 replies
FFilament
Created by lancodev on 8/23/2023 in #❓┊help
Multi-Tenancy HasManyThrough Tenant Relationship
2 replies