Tobias Platen
Tobias Platen
FFilament
Created by JJSanders on 1/3/2024 in #❓┊help
Modify the initial query when loading a table
Filters might be the better choice here.
Filter::make('is_sent')
->query(fn (Builder $query): Builder => $query->where('sent', true))
->default()
Filter::make('is_sent')
->query(fn (Builder $query): Builder => $query->where('sent', true))
->default()
If you modify the BaseQuery, you will never be able to view the other entries. With the filter, you can see all entries with just one click.
7 replies
FFilament
Created by Ahmed Ali on 1/3/2024 in #❓┊help
i have register auth page and i need to do action like
From Docu: Please be aware that the value of this field is still editable by the user if they decide to use the browser's developer tools. You should not use this component to store sensitive or read-only information.
8 replies
FFilament
Created by Yasser on 4/13/2023 in #❓┊help
Column Not Found SQL ERROR
Quote from Laravel Documentation:
Each migration filename contains a timestamp that allows Laravel to determine the order of the migrations:
Each migration filename contains a timestamp that allows Laravel to determine the order of the migrations:
The timestamp determines when each migration is executed. Change the timestamp in the filename to alter the order.
17 replies
FFilament
Created by Ahmed Ali on 1/3/2024 in #❓┊help
i have register auth page and i need to do action like
maybe something like this:
public function register(): ?RegistrationResponse
{
$return = parent::register();
Auth::user()->assignRole('admin');
return $return;
}
public function register(): ?RegistrationResponse
{
$return = parent::register();
Auth::user()->assignRole('admin');
return $return;
}
8 replies
FFilament
Created by Yasser on 4/13/2023 in #❓┊help
Column Not Found SQL ERROR
You have a sequencing issue. You can only establish a relationship between columns if both exist. The first migration that is executed attempts to establish relationships with a column in a table that doesn't even exist yet.
17 replies
FFilament
Created by JJSanders on 1/3/2024 in #❓┊help
Link user to record.
If you still want to solve this with Filament, you can do the following on the CreateRecord page:
protected function afterCreate(): void
{
$record = $this->getRecord();
$record->user_id = Auth::user()->id;
$record->save();
}
protected function afterCreate(): void
{
$record = $this->getRecord();
$record->user_id = Auth::user()->id;
$record->save();
}
However, you should keep in mind that only models created from within Filament will have the user set.
6 replies
FFilament
Created by JJSanders on 1/3/2024 in #❓┊help
Link user to record.
In Filament, there is nothing for that. But there are various Laravel packages that can do it. Take a look at wildside/userstamps, for example.
6 replies
FFilament
Created by Yasser on 4/13/2023 in #❓┊help
Column Not Found SQL ERROR
This is more of a Laravel issue, but why don't you show us your two migrations? Then we can probably find the error.
17 replies
FFilament
Created by xfly on 1/3/2024 in #❓┊help
Get relationship in select
Maybe not the simplest or most ideal way, but it works.
->options(
User::all()
->each(function(User $user) {
$user->full_name = $customer->first_name . ' ' . $customer->last_name;
})
->pluck('full_name', 'id'))
->options(
User::all()
->each(function(User $user) {
$user->full_name = $customer->first_name . ' ' . $customer->last_name;
})
->pluck('full_name', 'id'))
when your database implements concat()
->options(
User::selectRaw('id, CONCAT(first_name, \' \', last_name) as full_name')
->get()
->pluck('full_name','id'))
->options(
User::selectRaw('id, CONCAT(first_name, \' \', last_name) as full_name')
->get()
->pluck('full_name','id'))
4 replies
FFilament
Created by Sauravisus on 10/25/2023 in #❓┊help
Adding a save button to EditPage header
You are right. I played around a bit and found a solution.
protected function getFormActions(): array
{
return [
$this->getSaveFormAction()->extraAttributes(['style' => 'display:none']),
$this->getCancelFormAction()->extraAttributes(['style' => 'display:none']),
];
}

protected function getHeaderActions(): array
{
return [
$this->getSaveFormAction()
->submit(null)
->action('save'),
$this->getCancelFormAction(),
];
}
protected function getFormActions(): array
{
return [
$this->getSaveFormAction()->extraAttributes(['style' => 'display:none']),
$this->getCancelFormAction()->extraAttributes(['style' => 'display:none']),
];
}

protected function getHeaderActions(): array
{
return [
$this->getSaveFormAction()
->submit(null)
->action('save'),
$this->getCancelFormAction(),
];
}
11 replies
FFilament
Created by Sauravisus on 10/25/2023 in #❓┊help
Adding a save button to EditPage header
protected function getFormActions(): array
{
return [];
}
protected function getFormActions(): array
{
return [];
}
11 replies
FFilament
Created by Matthew on 12/30/2023 in #❓┊help
record in Create Record is null
This is more for validation purposes. The $this->halt() method should already be demonstrated with an example that cannot be easily resolved through validation alone.
9 replies
FFilament
Created by Oumuamua on 12/31/2023 in #❓┊help
Close Modal After Action from ManageRelatedRecords
If you show us your code, we might be able to help you better. Right now, it's just guessing. I have a task with a nested action in operation where the method cancelParentActions() works without any issues.
7 replies
FFilament
Created by Matthew on 12/30/2023 in #❓┊help
record in Create Record is null
Looks to me like a copy error in the documentation. In the EditRecord class, the getRecord() method should, as documented, return the corresponding model. However, in the CreateRecord class, the getRecord() method will only return the model in the last lifecycle hook afterCreate(). Before that, you will receive null. To access the data before that, you will need to use $this->form->getState(). Do you have an example case in which the $this->halt() method can be correctly explained?
9 replies
FFilament
Created by Mat on 1/1/2024 in #❓┊help
Custom message when saving/creating
I assume you are referring to the panel builder. Here, you need to adjust the page classes. Here are relevant excerpts from the documentation. https://filamentphp.com/docs/3.x/panels/resources/creating-records#customizing-the-save-notification https://filamentphp.com/docs/3.x/panels/resources/editing-records#customizing-the-save-notification
3 replies
FFilament
Created by Scott on 7/28/2023 in #❓┊help
Setting section background color
As far as I can see, this will only work globally for all section headers via styling of .fi-section-header. https://filamentphp.com/docs/3.x/support/style-customization#applying-styles-to-hook-classes
9 replies
FFilament
Created by KingNii on 12/31/2023 in #❓┊help
Select field issue, HELP!!!
It should also work with searchable().
44 replies
FFilament
Created by Oumuamua on 12/31/2023 in #❓┊help
Close Modal After Action from ManageRelatedRecords
Maybe cancelParentActions() ?
7 replies
FFilament
Created by KingNii on 12/31/2023 in #❓┊help
Select field issue, HELP!!!
TextInput::make('category_id'),
44 replies
FFilament
Created by KingNii on 12/31/2023 in #❓┊help
Select field issue, HELP!!!
What if you use a TextInput class instead of the Select class and enter the ID as a number there?
44 replies