mile4841
mile4841
FFilament
Created by mile4841 on 9/16/2024 in #❓┊help
Is it possible that based on the value of the component other component is not visible
Hi everyone how i can make that when mine component radio value is interval then i show mine component when is something else do not show
9 replies
FFilament
Created by mile4841 on 9/12/2024 in #❓┊help
Tiptap editor hint to the link
Is it possible to add the hint at the link like down below on the image. I want to add link must be in format http....
3 replies
FFilament
Created by mile4841 on 9/12/2024 in #❓┊help
Why modalFooterActions can not register an third action
I would like to have three buttons on mine slide over how i can make it? i look but it does not render mine three buttons just two what i should do so i can make it i have three buttons
->actions([
Tables\Actions\EditAction::make()
->slideOver()
->modalHeading(function(Team $teamMember){
return "Edit " . $teamMember->name['en'];
})
->modalFooterActions(function($action){
return [
Actions\Action::make('cancel')
->extraAttributes(['class' => 'secondary-btn'])
->action(function () {
$this->validate();
$this->save();
}),
Actions\Action::make('save and keep editing')
->extraAttributes(['class' => 'secondary-btn'])
->action(function () {
$this->validate();
$this->save();
}),
Actions\Action::make('save changes')
->extraAttributes(['class' => 'secondary-btn'])
->action(function () {
$this->validate();
$this->save();
}),
];
}),
->actions([
Tables\Actions\EditAction::make()
->slideOver()
->modalHeading(function(Team $teamMember){
return "Edit " . $teamMember->name['en'];
})
->modalFooterActions(function($action){
return [
Actions\Action::make('cancel')
->extraAttributes(['class' => 'secondary-btn'])
->action(function () {
$this->validate();
$this->save();
}),
Actions\Action::make('save and keep editing')
->extraAttributes(['class' => 'secondary-btn'])
->action(function () {
$this->validate();
$this->save();
}),
Actions\Action::make('save changes')
->extraAttributes(['class' => 'secondary-btn'])
->action(function () {
$this->validate();
$this->save();
}),
];
}),
13 replies
FFilament
Created by mile4841 on 9/12/2024 in #❓┊help
Remove delete on record
Is it possible that i disable option of delete on the record, i tried with these
Tables\Actions\DeleteAction::make()
->hidden(fn ($record) => $record->name === 'admin')
Tables\Actions\DeleteAction::make()
->hidden(fn ($record) => $record->name === 'admin')
but when user go into edit user he can press the command ctrl + D and delete record is it possible to remove this shoertcut or to remove delete or something else
2 replies
FFilament
Created by mile4841 on 9/11/2024 in #❓┊help
How in tiptap editor to set maxLength
I am using the tiptap editor and somehow when i set the maxLength for the content i get the error that there is not a function maxLength, i search in docs but there is not a function for the limit of content so what i should do
8 replies
FFilament
Created by mile4841 on 9/3/2024 in #❓┊help
Disable text input
Hi i have a problem i have a text input that is price and it could not be change, user can see it but not change. MIne problem comes when i want to save data i get the sql error that i have no value for price. How to solve these i can not use mutateDataBeforeCreate because i am using the slideOver.
5 replies
FFilament
Created by mile4841 on 9/3/2024 in #❓┊help
Why wrap is not working on the textcolumn
Hi everyone i am using text column to show mine note but the problem when text is longer it breaks the table and somehow ->wrap(true) is not working. What is here a problem
Tables\Columns\TextColumn::make('notes')
->label(__('table.notes'))
->copyable()
->wrap(true),
Tables\Columns\TextColumn::make('notes')
->label(__('table.notes'))
->copyable()
->wrap(true),
2 replies
FFilament
Created by mile4841 on 8/29/2024 in #❓┊help
How in richeditor to add option open link in new tab or not
Hi everyone mine question is in the heading. Does anybody knows how i can do this
2 replies
FFilament
Created by mile4841 on 8/27/2024 in #❓┊help
How to order naviation groups
Hi everyone is there a way i can reorder navigation groups for now if i am using the navigationSort is not working
13 replies
FFilament
Created by mile4841 on 8/26/2024 in #❓┊help
How to modify global search
Hi i would like to modify global search i want when user type something i take user input call mine class and then return the user input. Is this possible. On this discord question i said why i need these.
3 replies
FFilament
Created by mile4841 on 8/23/2024 in #❓┊help
Why selectColumn is not working
Hi i am using the plugin Shield, and i want in mine resource User to be able to change role. I made custom Role model which extends Spatie model, and i added a relationship to the user. Mine problem is that select column is not recognize mine relationship or something like that also i can not add default value for the select column.


use Spatie\Permission\Models\Role as SpatieRole;
class Role extends SpatieRole
{
// relationships
public function user() :HasMany
{
return $this->hasMany(User::class);
}
}


use Spatie\Permission\Models\Role as SpatieRole;
class Role extends SpatieRole
{
// relationships
public function user() :HasMany
{
return $this->hasMany(User::class);
}
}
User model
public function role()
{
return $this->belongsTo(Role::class);
}
public function role()
{
return $this->belongsTo(Role::class);
}
User table
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->searchable(),
Tables\Columns\TextColumn::make('email')
->searchable(),

Tables\Columns\SelectColumn::make('role')
->searchable(),

Tables\Columns\TextColumn::make('created_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->searchable(),
Tables\Columns\TextColumn::make('email')
->searchable(),

Tables\Columns\SelectColumn::make('role')
->searchable(),

Tables\Columns\TextColumn::make('created_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
Tables\Columns\TextColumn::make('updated_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
])
}
8 replies
FFilament
Created by mile4841 on 8/22/2024 in #❓┊help
Is it possible to disable to select a record in bulk action or somehow to disable delete bulk action
I have table with roles, roles can be edited but not all roles can be deleted i want to disable the option of deleting the role with name admin i did in table but i am not able to stop delete role with bulk action delete is it possible to disable the delete bulk action on some record or disable the select the record
11 replies
FFilament
Created by mile4841 on 8/22/2024 in #❓┊help
Why does TextInput does not want to save value
Hi everyone i have a problem where mine textinput does not want to save the value i enter. This is how i made the textinput

public static function form(Form $form): Form
{
return $form
->schema(Project::getForm())->columns(1);
}
// admin panel form
public static function getForm():array
{
return [
Tabs::make()->schema(Project::makeTabs()),

private static function makeTabs()
{
$tabs = [];
$languages = Languages::cases();
foreach($languages as $lang)
{
$tabs[] = Tab::make(Languages::getFullName($lang->name))
->schema([
TextInput::make("contents.{$lang->value}.title")
->required()
->maxLength(50)
->afterStateHydrated(function (TextInput $component, $state, $record) use ($lang) {
if($record){
$content = $record->contents()->language($lang->value)->first();
$component->state($content->title ?? null);
}
})

public static function form(Form $form): Form
{
return $form
->schema(Project::getForm())->columns(1);
}
// admin panel form
public static function getForm():array
{
return [
Tabs::make()->schema(Project::makeTabs()),

private static function makeTabs()
{
$tabs = [];
$languages = Languages::cases();
foreach($languages as $lang)
{
$tabs[] = Tab::make(Languages::getFullName($lang->name))
->schema([
TextInput::make("contents.{$lang->value}.title")
->required()
->maxLength(50)
->afterStateHydrated(function (TextInput $component, $state, $record) use ($lang) {
if($record){
$content = $record->contents()->language($lang->value)->first();
$component->state($content->title ?? null);
}
})
7 replies
FFilament
Created by mile4841 on 8/22/2024 in #❓┊help
How to set global search to search multilingual data
Hi i have a case where i want search multilingual website where in mine db for example column name values are in the form of json like
[
'en' => 'English name',
'gm' => 'German name',
'nl' => 'Dutch name',
]
[
'en' => 'English name',
'gm' => 'German name',
'nl' => 'Dutch name',
]
so how i can know search for german name etc... If i use dot notation in $recordTitleAttribute it will search for relationship and i will get the error is there a way i can do this. Mine problem is now that in mine db some letters are converted to the unicode values, so mine search is not working properly, i need to have something that will stop mine search(db query) and here i will make some logic. So i need to stop db query or to continue to search to see is this other language and convert it to the unicode values
2 replies
FFilament
Created by mile4841 on 8/21/2024 in #❓┊help
How to preload select
Hi i have a problem where i made mine select with down below code how i can now preload it? preload(true) is not working
Select::make('project_id')
->preload(true)
->label('Project')
->searchable()
->getSearchResultsUsing(function (string $search) use ($lang) {
return Project::with(['contents' => function ($query) use($lang) {
$query->where('language', $lang->value);
}])
->whereHas('contents', function ($query) use ($search, $lang) {
$query->where('title', 'like', "%{$search}%")->where('language', $lang->value);
})
->get()
->mapWithKeys(function ($project) use($lang) {
$firstTitle = $project->contents->where('language', $lang->value)->pluck('title')->first();
return [$project->id => $firstTitle];
});
})
->getOptionLabelUsing(function ($value) use($lang) {
$project = Project::with(['contents' => function ($query) use($lang) {
$query->where('language', $lang->value);
}])->find($value);
return $project ? $project->contents->pluck('title')->first() : '';
})
->required(),
Select::make('project_id')
->preload(true)
->label('Project')
->searchable()
->getSearchResultsUsing(function (string $search) use ($lang) {
return Project::with(['contents' => function ($query) use($lang) {
$query->where('language', $lang->value);
}])
->whereHas('contents', function ($query) use ($search, $lang) {
$query->where('title', 'like', "%{$search}%")->where('language', $lang->value);
})
->get()
->mapWithKeys(function ($project) use($lang) {
$firstTitle = $project->contents->where('language', $lang->value)->pluck('title')->first();
return [$project->id => $firstTitle];
});
})
->getOptionLabelUsing(function ($value) use($lang) {
$project = Project::with(['contents' => function ($query) use($lang) {
$query->where('language', $lang->value);
}])->find($value);
return $project ? $project->contents->pluck('title')->first() : '';
})
->required(),
8 replies
FFilament
Created by mile4841 on 8/21/2024 in #❓┊help
Shield does not generate mine resources
What are the reasons why shield is not allowing me to see the resources even i am logged and i have a role super_admin(that have all the permissions i look into table role_has_permissions it has) i have enable register_role_policy in the filament-shield.php config directory and i added to user model traits HasRoles, HasPanelShield and the interface FilamentUser and the function canAccessPanel. Mine code of setting users role(seeder) is
public function run(): void
{
$users = $this->getUsers();

foreach($users as $user){
$user->assignRole('super_admin');
}
}
public function run(): void
{
$users = $this->getUsers();

foreach($users as $user){
$user->assignRole('super_admin');
}
}
filament-shield config for the admin is
'super_admin' => [
'enabled' => true,
'name' => 'super_admin',
'define_via_gate' => false,
'intercept_gate' => 'before', // after
],
'super_admin' => [
'enabled' => true,
'name' => 'super_admin',
'define_via_gate' => false,
'intercept_gate' => 'before', // after
],
5 replies
FFilament
Created by mile4841 on 8/20/2024 in #❓┊help
SPA bug
Hi everyone i write this problem yesterday and i find why is it happening. It is because of spa. When i remove spa it works, i tried to add spaExceptions but still not works. Do you some work around i can do to fix this https://discord.com/channels/883083792112300104/1275016507931492498
3 replies
FFilament
Created by mile4841 on 8/19/2024 in #❓┊help
How to edit delete bulk action
Hi is it possible when it is selected one record that in mine modalDescription write delete this use with name... and when is selected more to write do you wan to delete this users
8 replies
FFilament
Created by mile4841 on 8/19/2024 in #❓┊help
Tabs Form error
No description
6 replies
FFilament
Created by mile4841 on 8/16/2024 in #❓┊help
How to reorder the navigation
Hi i have a problem where i can not move mine resource navigation link under the Group, i used
public static function getNavigationSort() :?int
{
return 9;
}
public static function getNavigationSort() :?int
{
return 9;
}
` The last link in the group has this value
public static function getNavigationSort() :?int
{
return 8;
}
public static function getNavigationSort() :?int
{
return 8;
}
7 replies