MK | Programmer
MK | Programmer
FFilament
Created by MK | Programmer on 10/24/2024 in #❓┊help
Install Plugin
Hello, I need help installing plugins in Filament. I would like to install this plugin:
https://filamentphp.com/plugins/joaopaulolndev-edit-profile
https://filamentphp.com/plugins/joaopaulolndev-edit-profile
I am following the steps in the #Installation section on the page. I added:
use Joaopaulolndev\FilamentEditProfile\FilamentEditProfilePlugin;

->plugin(
FilamentEditProfilePlugin::make()
->setIcon('heroicon-o-user')
->shouldShowBrowserSessionsForm()
);
use Joaopaulolndev\FilamentEditProfile\FilamentEditProfilePlugin;

->plugin(
FilamentEditProfilePlugin::make()
->setIcon('heroicon-o-user')
->shouldShowBrowserSessionsForm()
);
in AdminPanelProvider, but nothing changed in my dashboard. It seems that it wasn't installed correctly.
8 replies
FFilament
Created by MK | Programmer on 10/22/2024 in #❓┊help
User select
Hello, I'm starting to use FilamentPHP and would like to ask a question. How do I limit the user select to display only those with the role of realtor? I use this plugin: https://v2.filamentphp.com/plugins/althinect-spatie-roles-permissions
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('user_id')
->relationship('user', 'name')
->searchable()
->label(__('Realtor'))
->required(),
Forms\Components\TextInput::make('title')
->required()
->maxLength(255),
Forms\Components\Textarea::make('description')
->columnSpanFull(),
Forms\Components\TextInput::make('status')
->required(),
]);
}
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Select::make('user_id')
->relationship('user', 'name')
->searchable()
->label(__('Realtor'))
->required(),
Forms\Components\TextInput::make('title')
->required()
->maxLength(255),
Forms\Components\Textarea::make('description')
->columnSpanFull(),
Forms\Components\TextInput::make('status')
->required(),
]);
}
5 replies
FFilament
Created by MK | Programmer on 4/18/2024 in #❓┊help
Adding Action Buttons to Custom Page for Form Navigation
No description
5 replies
FFilament
Created by MK | Programmer on 4/17/2024 in #❓┊help
Implementing Role-Based Access Control for Custom Pages on Filament
Hello! How are you? I'm trying to define a specific middleware to access a custom page on Filament. How could I make it so that only, for example, those with the 'teacher' role can access a custom page? Is there a function I can put in page.php?
13 replies
FFilament
Created by MK | Programmer on 4/16/2024 in #❓┊help
Limiting Filament Table to User-Accessible in resource
Hello! How are you? I have a resource called SchoolResource for my School model. But I need only the schools that the user has permission to view to appear in the resource table. I already have a very simple method that does this, but I don't know how to limit the filament table.
public EloquentCollection|Collection $records;

public function mount(): void
{
$this->records = auth()->user()->schools();
}

public static function form(Form $form): Form
{
return $form
->schema(
[
//Abstracted............
]
)->columns(3);
}
public EloquentCollection|Collection $records;

public function mount(): void
{
$this->records = auth()->user()->schools();
}

public static function form(Form $form): Form
{
return $form
->schema(
[
//Abstracted............
]
)->columns(3);
}
8 replies
FFilament
Created by MK | Programmer on 4/15/2024 in #❓┊help
Preventing Duplicate 'Active' Records in Model Using Filament
Hello, I'm new to using filament, how can I prevent a new record in my SchoolDiar model from being written if another record with 'active' with value 'Ativa' already exists?
public static function form(Form $form): Form
{
return $form
->schema([
Select::make('active')
->options(['Ativa' => 'Ativa', 'Inativa' => 'Inativa'])
->native(false)
->default('Inativa')
->label('Status'),

}
public static function form(Form $form): Form
{
return $form
->schema([
Select::make('active')
->options(['Ativa' => 'Ativa', 'Inativa' => 'Inativa'])
->native(false)
->default('Inativa')
->label('Status'),

}
7 replies