Samer
Samer
FFilament
Created by Samer on 8/3/2024 in #❓┊help
SubNavigation width ?
Thanks Dennis
4 replies
FFilament
Created by Anish on 1/13/2024 in #❓┊help
Infolist : rendered html
Did you find away to this ?
3 replies
FFilament
Created by Milorn on 5/2/2024 in #❓┊help
How to expose table of ManageRelatedRecords to widget
inside the ListRecords class i just put this protected static string $relationship = 'Profiles'; then in the widget i use $profile = $this->getPageTableQuery()->getRelation('profiles')->count();
10 replies
FFilament
Created by Milorn on 5/2/2024 in #❓┊help
How to expose table of ManageRelatedRecords to widget
thanks
10 replies
FFilament
Created by Milorn on 5/2/2024 in #❓┊help
How to expose table of ManageRelatedRecords to widget
Oh i thought this was an old question just now notice it was one hour , sorry
10 replies
FFilament
Created by Milorn on 5/2/2024 in #❓┊help
How to expose table of ManageRelatedRecords to widget
@Milorn did you find away ?
10 replies
FFilament
Created by Samer on 5/2/2024 in #❓┊help
Can Filter tab be disabled ? , it's there but you can't click on it ?
Sorry I meant tabs that used to filter records
4 replies
FFilament
Created by Samer on 4/7/2024 in #❓┊help
hide row grouping for single records ( for the grouping field)
:squint:
3 replies
FFilament
Created by Samer on 8/8/2023 in #❓┊help
how dynamically add form text Input or spatieTag into resource based on non related model
i've did little bit of change, I'm using select now instead of SpatietagsInput , and saving with afterSAve() and refill with AfterFill and its working now .
protected function afterSave(): void
{

$AllowedTagsTypes = reportingTagsModel::with('ReportingTagsTypes')->where('taggable_type',$this->getModel())->get();
$TagsArray = [];

foreach ($AllowedTagsTypes as $Tagtype)
{
if (!empty($this->data[$Tagtype->ReportingTagsTypes->name]))
{
$TagsArray [] = $this->data[$Tagtype->ReportingTagsTypes->name];
}
}

$this->getRecord()->syncTags($TagsArray);
}

protected function afterFill()
{

$AllowedTagsTypes = reportingTagsModel::with('ReportingTagsTypes')->where('taggable_type',$this->getModel())->get();

foreach ($AllowedTagsTypes as $Tagtype)
{

$CurrenTags = $this->record->tags()->with('reportingTagsType')->where('tag_type_id',$Tagtype->ReportingTagsTypes->id)->get();

if (!empty($CurrenTags['0']))
{
$this->data[$Tagtype->ReportingTagsTypes->name] = $CurrenTags['0']->name;

}

}


}
protected function afterSave(): void
{

$AllowedTagsTypes = reportingTagsModel::with('ReportingTagsTypes')->where('taggable_type',$this->getModel())->get();
$TagsArray = [];

foreach ($AllowedTagsTypes as $Tagtype)
{
if (!empty($this->data[$Tagtype->ReportingTagsTypes->name]))
{
$TagsArray [] = $this->data[$Tagtype->ReportingTagsTypes->name];
}
}

$this->getRecord()->syncTags($TagsArray);
}

protected function afterFill()
{

$AllowedTagsTypes = reportingTagsModel::with('ReportingTagsTypes')->where('taggable_type',$this->getModel())->get();

foreach ($AllowedTagsTypes as $Tagtype)
{

$CurrenTags = $this->record->tags()->with('reportingTagsType')->where('tag_type_id',$Tagtype->ReportingTagsTypes->id)->get();

if (!empty($CurrenTags['0']))
{
$this->data[$Tagtype->ReportingTagsTypes->name] = $CurrenTags['0']->name;

}

}


}
38 replies
FFilament
Created by Son of Andy on 8/9/2023 in #❓┊help
Nest resources into sections in nav bar
2 replies
FFilament
Created by Samer on 8/8/2023 in #❓┊help
how dynamically add form text Input or spatieTag into resource based on non related model
the weird thing with dynamic names for example
SpatieTagsInput::make($Tagtype->ReportingTagsTypes->id)
->type($Tagtype->ReportingTagsTypes->id)
SpatieTagsInput::make($Tagtype->ReportingTagsTypes->id)
->type($Tagtype->ReportingTagsTypes->id)
it saves correctly without doing any custom saving, but I need to find a way to be able to fill it on edit to fill the input with the current value. not sure if i need to change this
$tags = $record->load('tags')->tagsWithType($type);
$tags = $record->load('tags')->tagsWithType($type);
in
class SpatieTagsInput extends TagsInput
class SpatieTagsInput extends TagsInput
38 replies
FFilament
Created by Samer on 8/8/2023 in #❓┊help
how dynamically add form text Input or spatieTag into resource based on non related model
Oh , thanks , i think this will work , I'll try it 🙂
38 replies
FFilament
Created by Samer on 8/8/2023 in #❓┊help
how dynamically add form text Input or spatieTag into resource based on non related model
now i need to work on the tags and saving them 😀
38 replies
FFilament
Created by Samer on 8/8/2023 in #❓┊help
how dynamically add form text Input or spatieTag into resource based on non related model
38 replies
FFilament
Created by Samer on 8/8/2023 in #❓┊help
how dynamically add form text Input or spatieTag into resource based on non related model
Hi @pboivin Thanks for the tips, I managed to get it working using what you suggested i did two arrays one for normal inputs and i copied the form schema to it,and one array filled from the loop to get the fields dynamically then i pass them both with array merge to form schema.
$DynamicInputs = [];
$AllowedTagsTypes = reportingTagsModel::with('ReportingTagsTypes')->where('taggable_type',self::$model)->get();

foreach ($AllowedTagsTypes as $Tagtype) {
$DynamicInputs[] = SpatieTagsInput::make('tags')->label($Tagtype->ReportingTagsTypes->name)->helperText($Tagtype->taggable_type)->columnSpanFull();
}

$DynamicInputs = [];
$AllowedTagsTypes = reportingTagsModel::with('ReportingTagsTypes')->where('taggable_type',self::$model)->get();

foreach ($AllowedTagsTypes as $Tagtype) {
$DynamicInputs[] = SpatieTagsInput::make('tags')->label($Tagtype->ReportingTagsTypes->name)->helperText($Tagtype->taggable_type)->columnSpanFull();
}

NormalInputs = [
TextInput::make('code')
->required(),
...,]
NormalInputs = [
TextInput::make('code')
->required(),
...,]
then
return $form->schema(array_merge($NormalInputs,$DynamicInputs));
return $form->schema(array_merge($NormalInputs,$DynamicInputs));
38 replies
FFilament
Created by Samer on 8/8/2023 in #❓┊help
how dynamically add form text Input or spatieTag into resource based on non related model
Yes , Thanks , i'll explore this , Thanks for your time
38 replies
FFilament
Created by Samer on 8/8/2023 in #❓┊help
how dynamically add form text Input or spatieTag into resource based on non related model
so i can do something like function in hooks function { TagsTypeModel::All() ; foreach each tagType { SpatiTaginput::make() } } ?
38 replies
FFilament
Created by Samer on 8/8/2023 in #❓┊help
how dynamically add form text Input or spatieTag into resource based on non related model
,ok for point #2 lets say this invoiceResource have like 3 tags type should be attached to each invoice, for example each invoice should be attached to A Project tag , A department tag and a user Tag , so in that Create/Edit in invoice Resource we need to dynamically have 3 input fields
38 replies
FFilament
Created by Samer on 8/8/2023 in #❓┊help
how dynamically add form text Input or spatieTag into resource based on non related model
just want to have a direction , as I'm completely new to this
38 replies
FFilament
Created by Samer on 8/8/2023 in #❓┊help
how dynamically add form text Input or spatieTag into resource based on non related model
no problem 🙂
38 replies