Positiverain
Advanced toggle column to a table
My database table doesn't have an
is_collected
column. Instead, I have a collected_by
column (foreign key to a collectors table) and a collected_at
timestamp. How can I customize the ToggleColumn to update the collected_by
and collected_at
columns when toggled on, ideally setting collected_by
to auth()->user()->collector_id
? By default the toggle sets is_collected
to 1 but that column does not exist.4 replies
How do I fix Enum could not be converted into string when using export action?
I want to know how to format the state of the enum without the "could not be converted to string" error. Its the $state itself that is in type string throwing the error. Without the $state in the
->state(function ($state) {
function it works well.
^ I don't think this is relevant but here is the cast1 replies
Custom Page - How do I show confirmation dialog on Submit?
Also how do I modify the confirmation dialog? Is this even possible in filament v3?
I am using
use InteractsWithForms
. If I use submit, there isn't any confirmation modals/dialog, the action just happens. The ->form([])
of the action also doesn't work. Only thing the action can do is ->submit()
Adding a use InteractsWithActions
Action to the Page with the page view can do what I want, but the original form of the page isn't validated when using this action.2 replies
Filament Resource Create/Edit BadMethodCallException Call to undefined method HasMany::associate()
I have a User model as well as a Patch model, every patch HasMany users. What I am trying to achieve is: I want to add Users to Patch.
Code:
User migration:
Patch migration
After this I created a filament-resource: PatchResource. Inside the form I did:
What did I do wrong here?
1 replies
What's the difference between Tables\Actions\CreateAction and Actions\CreateAction?
One has
and the other has
Both are having
class CreateAction extends Action
.
I want to use the same functions for ->using(function(*stuffs*) {
method of both CreateActions. One of the create action is in the Resource page empty state actions and the other one is in the ManageResource page header. Is there a way to do so?2 replies
How to add a custom 'CreateRecord Page' to the sidebar navigation?
If I use
I am replacing the default navigation items, including those that are added through plugins. Is there a method I can use with
$builder->items([...this_method_calls_default_nav_items()...])
so that I can retrieve the default navigation items?5 replies
How to setup email verification after the email has been changed?
I am using on my AdminPanelServiceProvider. Email verification is perfectly working after registering a new user. In the MyProfile page used by the filament-breezy, the user can change their email and I have made it so that the email_verified_at is set to null when the email is different from the previous email, that is before the user email is updated. I can't find a way to verify email for a second time, after changing the email.
1 replies
Eloquent Builder with relationships
I could use $user->hasRole('admin') to identify admins. But filament uses query builder for generating tables: parent::getEloquentQuery().
How do I make it so that parent::getEloquentQuery would generate table with only admin records? ->with('roles') isn't working.
(I am using spatie permissions)
8 replies
How to use two forms for two models in one resource? Is it even possible?
Noob here. Maybe I am not using the best practices, but I have a User model (which has username, password, email etc) and a UserDetails model (which has full names, departments, whatsoever). In the same resource I want to make it so that when adding a User using create User, There's one form for username, email and password, there is a next button which would switch to UserDetails form. Only after completing all the required fields it would be possible to submit the form.
4 replies