Sander
Sander
Explore posts from servers
FFilament
Created by Sander on 4/23/2023 in #❓┊help
Attach Multiple | How does it work?
So after initially looking at this post I thought it would be straight forward: https://filamentphp.com/tricks/allow-multiple-records-in-a-attach-select However this alone is not enough as it only attached the first record selected even after implementing this:
Tables\Actions\AttachAction::make()
->recordSelect(function (Forms\Components\Select $select) {
return $select->multiple();
})
->recordSelectOptionsQuery(fn($query) => $query->where('article_type_id', ArticleTypeEnum::courses->getId()))
->preloadRecordSelect(),
Tables\Actions\AttachAction::make()
->recordSelect(function (Forms\Components\Select $select) {
return $select->multiple();
})
->recordSelectOptionsQuery(fn($query) => $query->where('article_type_id', ArticleTypeEnum::courses->getId()))
->preloadRecordSelect(),
Any advice? The only 'using' method I see is ->using() so not very descriptive.
22 replies
FFilament
Created by Sander on 4/7/2023 in #❓┊help
I broke media library, only works on edit and not on create.
I have a very unusual situation... Forms\Components\SpatieMediaLibraryFileUpload works on edit but not on create somehow... There are 0 errors and no exceptions fired. I am not sure what is going on, any help troubleshooting the creation of the record would be awesome. Storage link is already put in place and the APP_URL is http://127.0.0.1:8000 SESSION_DOMAIN=127.0.0.1 This is the case for 2 models, Article and Course, course must be the easiest to trouble shoot as it doesn't have many things going on.
9 replies
FFilament
Created by Sander on 4/3/2023 in #❓┊help
getTableReorderColumn() pivot column
I have 3 models one of which is Pivot::class Article, Course, ArticleCourse The pivot uses eloquent-sortable, the Pivot implements Sortable and uses the SortableTrait. Upon attaching thus creating a pivot record the 'sort_when_creating' => true, doesn't seem to fire. Also with:
protected function getTableReorderColumn(): ?string
{
return 'article_course.order_column'; //or 'order_column, both fail;
}
protected function getTableReorderColumn(): ?string
{
return 'article_course.order_column'; //or 'order_column, both fail;
}
When dragging and dropping the records I get:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'article_course.order_column' in 'field list' (Connection: mysql, SQL: update `articles` set `article_course`.`order_column` = 1, `articles`.`updated_at` = 2023-04-03 20:28:40 where `id` = 15)
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'article_course.order_column' in 'field list' (Connection: mysql, SQL: update `articles` set `article_course`.`order_column` = 1, `articles`.`updated_at` = 2023-04-03 20:28:40 where `id` = 15)
Any suggestions as how to solve this issue? Are there existing solutions available? Justification: Some articles can be reused within other courses lets say a common recurring one like how to install something. It is to be used within a many to many relationship manager
2 replies