Pan
Searchable either name or barcode
What I am trying to do:
In my relationship manager, I have an action have a form field wherein I can type either the name or barcode of an equipment record and they show the same record with the same label, I want it to still display the name even if I searched the barcode
What I did:
I tried using this
https://filamentphp.com/docs/3.x/forms/fields/select#returning-custom-search-results
wherein I can indeed search by typing the barcode and it labels with the name
but I can't search by simply searching the name. Probably because the
Equipment::where('barcode')
I tried adding where('barcode','name')
but I get an error SQLSTATE[42000]: Syntax error
My issue/the error:
I am unaware if its possible to do search both columns in a single field and how to do that.
I am amateur when it comes to php
Code:
7 replies
Upgrade from 3.0 to 3.2 led to SpatieMedia::hasRelationship does not exist in my livewire
What I am trying to do:
I am updating from filament 3.0 to 3.2 for the sake of getting the csv export feature.
What I did:
I did the these
even the
since it was occuring on my livewire page
I tried
if it might help but same result
My issue/the error:
I keep getting this error when loading the livewire page
Method Filament\Tables\Columns\SpatieMediaLibraryImageColumn::hasRelationship does not exist.
Code:
The is highlighted on the debug page
It used to work before I update, but I really want that export feature
16 replies
Get the owner record while at their Edit Page
What I am trying to do:
I want to disable a field ('changing their role or changing their password') if the current record that a moderator is editing has a role of Admin.
I wanted to start with by getting the ownerRecord but I am lost
What I did:
I used this for getting the ownerRecord for the relation manager but does not work when at the UserResource and tried following the second that used
$livewire->ownerRecord)
but seem to be not the solution
https://filamentphp.com/docs/2.x/admin/resources/relation-managers#accessing-the-owner-record
My issue/the error:
If i try to call the ownerRecord I just get
Undefined property: UserResource::$ownerRecord3 replies
Custom Action
What I am trying to do:
I am trying to create a custom action like the AssociateAction however I want to customize it on my own form.
What I did:
I tried following this
https://filamentphp.com/docs/3.x/actions/modals#modal-forms, specifically this part
I've changed the $record into $post and the author() into just
->user_id
and right now I am testing it ->associate(1)
by just passing an int to see if it works.
My issue/the error:
if I kept the $post-user_id()->associate(1)
i get the error BadMethodCall
Call to undefined method App\Models\Equipment::user_id()
changing it into post-user_id->associate(1)
i get the error Call to a member function associate() on null
Code:
Ignore the other headerActions like AssociateAction and 'Borrow'
Thank you !!!!19 replies
How to create a form to Edit record instead of Create in RelationManager excluding AssociateAction
I have a relation manager in my userResource and I tried AssociateAction and it works however I need to be able to customize so I thought of creating a custom Action but when I create a form schema for it. But when I simply save it, it just creates a new record. I want to instead update the equipment field foreign id for user_id to what user edit record page I am currently at.
I also want it to be multiple() so I don't have to do it one by one
3 replies
Relation Manager customizing AssosciateAction to use multiples and updating a field based on another
I have a relation manager called EquipmentsRelationManager under UserResource. I added the
Tables\Actions\AssociateAction::make()
at the headerActions, however I want it to be multiple instead of having to manually press the "Associate & Associate another" as instead I want to use like in the Filament Demo wherein the categories can easily add multiple categories
Filament Demo:
Currently here is what I hope is working but it doesnt
I also want to know how if the table equipment field foreign id for user_id, that if it nots null, one of the field is be updated too, if you have any idea please share.2 replies
Change relation manager to instead creating a new record, select from an existing record to attach.
I have a
UserResource
with a relation manager for equipment.
However instead of creating a new record "New Equipment" at the edit page of User, I want it to actually be where it simply updates the selected Equipment user_id
to what user I am currently at the edit page of.
As of now I only have this at the EquipmentsRelationmanager.php
wherein it only shows Options that doesn't have a user_id already in
this leads to simply creation of a new record.
I am a beginner, hoping a clear explanation and guidance for my level. Thank you!4 replies
Filament Demo shop_category_product, how does it work?
I've checked out the migration files of the three tables "shop_categories", "shop_category_product" and "shop_products".
I've noticed that in the "shop_products" & "shop_categories" there are no foreign id field for each other but instead in the model of those two tables, they have a BelongsToMany relationship with "shop_category_product". and at that table seems to be where magic happens where it foreign id to both the primary id of "shop_products" & "shop_categories" as its primary key.
What I don't understand is how it seem to still perfectly all connected by showing the categories attached to the product while in the product table there's no categories field. Like how does the "shop_category_product" table updates when a new attachment of a category on a product is added and how it is shown in the Forms of of "ProductResource.php"
This seem to be the magic of the code but I can't find out how it works playing around.
4 replies
Foreign Primary key in Demo and can relation manager only add existing record but require signature?
I was playing around with the filamentdemo and how there is a table called "shop_category_product" where it shows each record 'shop_category_id' & 'shop_product_id' and I want to know how it knows when to add a new record automatically when a shop product id has added a new record especially the only foreignId I see at the "shop_products" table is the 'shop_brand_id'?
I also have another question, I tried the relation manager in the vet management guide, is it possible to only be able to add existing "treatment" and select from them?
As well as require a signature like uploading a fingerprint image before being saved (Within relation manager as well)
It might help better to understand my situation.
I am creating a project thesis where we create a online borrowing website.
I thought it be user-friendly if its straightforward where a student assistance (school context) just go to a user edit and attach an item to the user but it needs to have a fingerprint signature to make sure that the borrowing was legit.
I was planning initially to just create a form and add a repeater to it and manually keep adding the items but that seems to be a lot of hassle for the student assistance. Our goal is to simplify the borrowing while also making sure that every changes in the inventory is tracked accurately.
If you have a suggestion on how I could approach this better, please advice me. Thank you
2 replies
Will there be a problem using same named Resource but under different Panel
I have an admin panel and moderator panel but I wanted to move a resource called UserResource since I found out I could hide some parts of the resource if they are not admin, I tried moving the UserResource from the 'filament/resources' to 'filament/Moderator/resources' tried updating the namespaces of the moved resource with 'Moderator' but I keep getting errors trying to do so.
Instead I tried to just create a resource the same name since to be honest they are going to use the same table and model anyway but just different shown schema for the forms creation and edit.
I just begun learning Laravel this October and found out filament at around mid October. I need to be able to accomplish my thesis to show a prototype early December.
What I am actually asking is, will there be a problem going forward having two same named resources but under different panels although they are going to use the same model and table as well. Will there be a problem later on due to it?
4 replies