229201518
229201518
FFilament
Created by 229201518 on 7/4/2024 in #❓┊help
SpatieMediaLibraryFileUpload in Custom Page
I have a customized page with a form, the media relationship is working fine, but the image is not displayed in the media input. ✅ APP_URL
4 replies
FFilament
Created by 229201518 on 6/10/2024 in #❓┊help
(HELP) Multi permissions
Hello, Im developing a new system based in: Factories, Stores and a master admin. Factories can have multiple users; Stores can have multiple users; Admin can access all the resources. Basically, the factory can only access products and sales resources, but can i have a user relationed with the factory only with the product resource permission, and another with the sales only. Then, ill has a main permission in the factory and sub-permissions in the relationed users. Has a easy/practice way to implement this? Sorry if it was a little confusing
2 replies
FFilament
Created by 229201518 on 6/5/2024 in #❓┊help
Get current model inside relationManager
Has a way to get the current model inside a RelationManager? My use case: I have a UserResource with a separate class called UserForm (with the form method to reuse); A AnotherResource with UserRelationManager, and inside the manager im using the same UserForm; A password field with ->visible(fn ($livewire) => $livewire instanceof CreateUser), but this dont works in a RelationManager.
5 replies
FFilament
Created by 229201518 on 6/3/2024 in #❓┊help
Percentage and money mask
Has a easy way to implement percentage mask and money mask? Percentage example: 0 - 100% (can accept 99,25%); Money example: 3.550,75
2 replies
FFilament
Created by 229201518 on 6/2/2024 in #❓┊help
Panels with some identical resources
Hello, I have a application with 3 different panels (admin, factory and storekeeper). Basically: Admin panel can access with the guard user and role admin; Factory panel can acess with guard factory; Storekeeper panel can acess with guard shop; The admin can access all the resources; The factory can access just products and sales resources, and there must be logic to search only for products related to the factory logged in. Storekeeper mantain the factory logic, acessing just the sales and products related to the storekeeper logged in. What would be the correct way to block these resources depending on the panel? Is there any way to have a variable in the resource (like $factoryCanAcess: bool), and inside each panel in discoverResources i check for the variable?
6 replies
FFilament
Created by 229201518 on 5/28/2024 in #❓┊help
Custom resources directories
Has a way to create resources in custom folders? Im using a modular architeture, for example, i have 3 different models: base_path/modules/User, base_path/modules/Factory, base_path/modules/Car, And inside each module, i have a folder called filament/resources, and inside each resources i have the respective Resource. Is there any way to go through all the module folders and “attach” the resources? In filament v2, this provider this provider was working:
class RegisterResourcesServiceProvider extends FilamentPluginServiceProvider
{
public static string $name = 'registerResources';

public array $resources = [];

public function register()
{
parent::register();

$folders = File::directories(base_path('modules'));
foreach ($folders as $folder) {
$folderName = basename($folder);
$resourceFiles = glob($folder . '/pages/*Resource.php');

foreach ($resourceFiles as $resourceFile) {
$resourceClassName = basename($resourceFile, '.php');
$this->resources[] = 'System\\' . $folderName . '\\pages\\' . $resourceClassName;
}
}

$this->app->resolving('filament', function () {
Filament::registerResources($this->resources);
});
}
}
class RegisterResourcesServiceProvider extends FilamentPluginServiceProvider
{
public static string $name = 'registerResources';

public array $resources = [];

public function register()
{
parent::register();

$folders = File::directories(base_path('modules'));
foreach ($folders as $folder) {
$folderName = basename($folder);
$resourceFiles = glob($folder . '/pages/*Resource.php');

foreach ($resourceFiles as $resourceFile) {
$resourceClassName = basename($resourceFile, '.php');
$this->resources[] = 'System\\' . $folderName . '\\pages\\' . $resourceClassName;
}
}

$this->app->resolving('filament', function () {
Filament::registerResources($this->resources);
});
}
}
39 replies