Patrick Jean
Patrick Jean
FFilament
Created by Patrick Jean on 9/2/2024 in #❓┊help
Relation Manager policies
Hello guys! I'm implementing policies on my project and get a problem. I utilize the Relation Manager (attach) on some of my "policied idk if is correct to spell that way" resources. When i try to attach any register, all of them appears, like the example: I have a BusinessResource, that attaches Places with RelationManager, but when my user type is "user" instead "superuser", i need to search only places that have owner_id === auth()->user()->id. I will attach some files to try explain how i doing the policies. To filter on the list, i use the getEloquentQuery method, see bellow, but didnt work to attaches select:
php

public static function getEloquentQuery(): Builder
{
$query = parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);

if (!auth()->user()->isSuperUser()) {
$query->where('owner_id', auth()->id());
}

return $query;
}
php

public static function getEloquentQuery(): Builder
{
$query = parent::getEloquentQuery()
->withoutGlobalScopes([
SoftDeletingScope::class,
]);

if (!auth()->user()->isSuperUser()) {
$query->where('owner_id', auth()->id());
}

return $query;
}
6 replies
FFilament
Created by Patrick Jean on 7/26/2024 in #❓┊help
Problems to upload file to S3
Hello Guys. I'm trying to upload a file to S3 using Filament FileUpload component. It upload to S3 in a tmp folder (livewire-tmp) and when i hit "Save changes" in filament, its disappears from the tmp folder and write the filename to db (ex: ["01J3RFMJWTXCF4B7VYKP098M1Y.webp", "01J3RFR9CNAX9SSX3ECHGX9K6Y.webp"].) and the UploadFile component updates and not show the uploaded images. Searching inside the S3 Bucket, i do not have any file inside :/ Someone pass through this problem yet? Thanks for any help! 🙂
8 replies