Luukd_2000
Luukd_2000
FFilament
Created by Luukd_2000 on 8/10/2024 in #❓┊help
Badge color on minimal theme missing
Hi, I just bought the minimal theme. Im having problems with the badges. Its not showing any color. The .fi-badge.fi-color-custom is causing this. if i remove the background-color in that class, it works. What am I doing wrong?
6 replies
FFilament
Created by Luukd_2000 on 6/20/2024 in #❓┊help
Filament Simple Page Route Returning 404
Help Needed: Filament Simple Page Route Returning 404 Hi everyone, I'm trying to create a simple page using Filament in my Laravel application, but I'm encountering a 404 error when I navigate to the route. Here's what I have so far:
namespace App\Filament\Pages;

use Filament\Pages\SimplePage;

class TransportOrder extends SimplePage
{
protected static string $view = 'filament.pages.transport-order';
}
namespace App\Filament\Pages;

use Filament\Pages\SimplePage;

class TransportOrder extends SimplePage
{
protected static string $view = 'filament.pages.transport-order';
}
My blade file
<x-filament-panels::page.simple>

</x-filament-panels::page.simple>
<x-filament-panels::page.simple>

</x-filament-panels::page.simple>
My routes web.php
use App\Http\Controllers\OrderController;
use App\Http\Controllers\OrderTransporterController;
use Illuminate\Support\Facades\Route;
use App\Filament\Pages\TransportOrder;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/

Route::get('transportorder', [TransportOrder::class, 'render'])->name('transportOrder');
use App\Http\Controllers\OrderController;
use App\Http\Controllers\OrderTransporterController;
use Illuminate\Support\Facades\Route;
use App\Filament\Pages\TransportOrder;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/

Route::get('transportorder', [TransportOrder::class, 'render'])->name('transportOrder');
What am I doing wrong?
10 replies
FFilament
Created by Luukd_2000 on 6/3/2024 in #❓┊help
How to Display a action modal with Task Status Before Allowing Users to Edit a Model?
Hello, I have a table with a model, and before users can edit the model, the system needs to perform several tasks. These tasks are added to a queue and processed when a worker becomes available. I want to prevent users from accessing the edit page until these tasks are completed. Instead, I would like to display a action modal with a custom modalView that shows the status of the pending tasks. Is it possible to implement this feature? If so, how can I achieve it?
2 replies
FFilament
Created by Luukd_2000 on 5/13/2024 in #❓┊help
Hide custom page from main nav but not from subnavigation
Hello, I have created a custom page. This page is currenlty showing in the main navbar. If i do shouldRegisterNavigation = false, it hides the item in the main and subnavigation. How do I only hide the page in the main navbar?
3 replies
FFilament
Created by Luukd_2000 on 4/18/2024 in #❓┊help
Change edit modal width
Hello, I am currently creating a manage relation page for my resource. I have two form sections in the edit modal. I would like to display them next to each other. To do this, the modal has to be 90% of the screen width. How do I do that?
3 replies
FFilament
Created by Luukd_2000 on 2/19/2024 in #❓┊help
getNavigationBadge on a managerelatedrecords page
Hello, I have a submenu with some custom ManageRelatedRecords pages. I would like to add a counter badge next to the navigation. The problem im getting is that static::getModel()::count(); cannot be called staticaly. How do I fix this?
6 replies
FFilament
Created by Luukd_2000 on 2/16/2024 in #❓┊help
mutateFormDataBeforeCreate does not add the field to the query
Hello, I am currently trying to add the user_id to the form array when a user creates a new entry. In the Create class of the Filament recourse I have this:
protected function mutateFormDataBeforeCreate(array $data): array
{
$data['user_id'] = auth()->user()->id;
return $data;
}
protected function mutateFormDataBeforeCreate(array $data): array
{
$data['user_id'] = auth()->user()->id;
return $data;
}
For some reason, the query is this: SQLSTATE[HY000]: General error: 1364 Field 'user_id' doesn't have a default value
INSERT INTO
`websites` (`name`, `url`, `type`, `updated_at`, `created_at`)
VALUES
(
test,
test.nl,
0,
2024 -02 -16 19: 41: 11,
2024 -02 -16 19: 41: 11
)
INSERT INTO
`websites` (`name`, `url`, `type`, `updated_at`, `created_at`)
VALUES
(
test,
test.nl,
0,
2024 -02 -16 19: 41: 11,
2024 -02 -16 19: 41: 11
)
What am I doing wrong?
4 replies
FFilament
Created by Luukd_2000 on 1/16/2024 in #❓┊help
Select form component with relation loads items from other tenants
Hello, I have a form component that loads all of the items from every tenant. How do I only load the items for that tenant?
Select::make('relation_id')->label('Kies een relatie')
->searchable()
->preload()
->required()
->relationship('relation', 'contact_name')
->reactive()
->createOptionForm([
Forms\Components\TextInput::make('contact_name')->label('Contact persoon')->required(),
Forms\Components\Hidden::make('organisation_id')->default(Filament::getTenant()->id),
Forms\Components\TextInput::make('email')->label('Email')->email(),
Forms\Components\TextInput::make('company_name')->label('Bedrijfsnaam'),
Forms\Components\TextInput::make('phone')->label('Telefoon'),
Forms\Components\TextInput::make('vat_number')->label('Belastingnummer'),
Forms\Components\TextInput::make('kvk_number')->label('KVK nummer'),
]),
Select::make('relation_id')->label('Kies een relatie')
->searchable()
->preload()
->required()
->relationship('relation', 'contact_name')
->reactive()
->createOptionForm([
Forms\Components\TextInput::make('contact_name')->label('Contact persoon')->required(),
Forms\Components\Hidden::make('organisation_id')->default(Filament::getTenant()->id),
Forms\Components\TextInput::make('email')->label('Email')->email(),
Forms\Components\TextInput::make('company_name')->label('Bedrijfsnaam'),
Forms\Components\TextInput::make('phone')->label('Telefoon'),
Forms\Components\TextInput::make('vat_number')->label('Belastingnummer'),
Forms\Components\TextInput::make('kvk_number')->label('KVK nummer'),
]),
3 replies
FFilament
Created by Luukd_2000 on 1/11/2024 in #❓┊help
How do I create a relation manager for a pivot table
Hello, I have a Container class and I have a Transporter class. i have a pivot table with transporter_id, container_id and price called container_transporter. I would like to manage the containers and price in the transporter resource. I have setup my models like this:
// In Container model
public function transporters()
{
return $this->belongsToMany(Transporter::class, 'container_transporter')
->withPivot('price');
}
// In Container model
public function transporters()
{
return $this->belongsToMany(Transporter::class, 'container_transporter')
->withPivot('price');
}
// In Transporter model
public function containers()
{
return $this->belongsToMany(Container::class, 'container_transporter')
->withPivot('price');
}
// In Transporter model
public function containers()
{
return $this->belongsToMany(Container::class, 'container_transporter')
->withPivot('price');
}
How do I set this up in the relationmanager?
3 replies
FFilament
Created by Luukd_2000 on 12/5/2023 in #❓┊help
Dropdown Options Not Displaying in Reactive Filament Form Section When Disabled
I'm working with a Filament form and facing an issue with a section that is conditionally disabled. Here's the setup: I have a section created with
Forms\Components\Section::make('Relatie')
Forms\Components\Section::make('Relatie')
and it's disabled based on a condition:
->disabled(fn (Forms\Get $get) => $get('c_type_id') == null)
->disabled(fn (Forms\Get $get) => $get('c_type_id') == null)
. This conditional disabling is functioning as expected. The section is disabled when 'c_type_id' is null and becomes enabled when a 'c_type_id' is selected. The issue arises with a Select component within this enabled section. The Select component is defined as follows:
Forms\Components\Select::make('relation_id')
->label('Kies een relatie')
->searchable()
->preload()
->required()
->relationship('relation', 'contact_name')
->reactive()
->createOptionForm([
Forms\Components\TextInput::make('contact_name')->label('Contact persoon')->required(),
Forms\Components\Hidden::make('organisation_id')->default(Filament::getTenant()->id),
Forms\Components\TextInput::make('email')->label('Email')->email(),
Forms\Components\TextInput::make('company_name')->label('Bedrijfsnaam'),
Forms\Components\TextInput::make('phone')->label('Telefoon'),
Forms\Components\TextInput::make('vat_number')->label('Belastingnummer'),
Forms\Components\TextInput::make('kvk_number')->label('KVK nummer'),
])
Forms\Components\Select::make('relation_id')
->label('Kies een relatie')
->searchable()
->preload()
->required()
->relationship('relation', 'contact_name')
->reactive()
->createOptionForm([
Forms\Components\TextInput::make('contact_name')->label('Contact persoon')->required(),
Forms\Components\Hidden::make('organisation_id')->default(Filament::getTenant()->id),
Forms\Components\TextInput::make('email')->label('Email')->email(),
Forms\Components\TextInput::make('company_name')->label('Bedrijfsnaam'),
Forms\Components\TextInput::make('phone')->label('Telefoon'),
Forms\Components\TextInput::make('vat_number')->label('Belastingnummer'),
Forms\Components\TextInput::make('kvk_number')->label('KVK nummer'),
])
When the section is enabled (i.e., 'c_type_id' is selected), I can interact with the Select component, and it allows me to create new relationships using the createOptionForm. However, the main issue is that the dropdown list itself does not show up. What could be causing the dropdown not to display? Are there any additional settings or adjustments I need to make to ensure the dropdown list is visible and functional when the section is enabled?
2 replies
FFilament
Created by Luukd_2000 on 10/23/2023 in #❓┊help
Add custom data to the user model after filling in the registration form
Hi, I have two panels. 1 for organisations and 1 for freelancers. When a freelancer creates a new account the account_type column should be set to freelancer. When a organisation creates a new account the account_type column should be set to organisation. Where do I add this?
15 replies
FFilament
Created by Luukd_2000 on 10/9/2023 in #❓┊help
createOptionForm does not return the correct query
Hi, I am tying to create a createOptionForm. But for some reason it is ignoring all of the fields I defined. It just gives a basic create query:
INSERT INTO `relation_addresses` (`updated_at`, `created_at`) VALUES (2023-10-09 14:46:58, 2023-10-09 14:46:58)
INSERT INTO `relation_addresses` (`updated_at`, `created_at`) VALUES (2023-10-09 14:46:58, 2023-10-09 14:46:58)
This is my select input: (I removed some fields due to the Discord character limit.)
->createOptionForm(function (Get $get) {
return [
Forms\Components\TextInput::make('relation_id')->default($get('relation_id')),
Forms\Components\TextInput::make('name')->label('Naam')
->required()
->maxLength(255),
];

}
->createOptionForm(function (Get $get) {
return [
Forms\Components\TextInput::make('relation_id')->default($get('relation_id')),
Forms\Components\TextInput::make('name')->label('Naam')
->required()
->maxLength(255),
];

}
This is the parent select:
Forms\Components\Select::make('relation_address_id')->label('Kies een adres')
->relationship('relationAddress', 'name')
->disabled(fn (Forms\Get $get) => $get('relation_id') == null)
->required()
->options(function(callable $get) {
$relation = Relation::find($get('relation_id'));
if (!$relation) {
return [];
}
return $relation->addresses()->pluck('name', 'id');
})
->createOptionForm(__The code above__)
);
Forms\Components\Select::make('relation_address_id')->label('Kies een adres')
->relationship('relationAddress', 'name')
->disabled(fn (Forms\Get $get) => $get('relation_id') == null)
->required()
->options(function(callable $get) {
$relation = Relation::find($get('relation_id'));
if (!$relation) {
return [];
}
return $relation->addresses()->pluck('name', 'id');
})
->createOptionForm(__The code above__)
);
Does anyone know what I am doing wrong?
6 replies
FFilament
Created by Luukd_2000 on 9/28/2023 in #❓┊help
Hide table actions for certain rows
Hi, Is it possible to hide certain table actions for example the editAction if a field of that row has a specific value?
5 replies
FFilament
Created by Luukd_2000 on 9/4/2023 in #❓┊help
Triggering Filament Action with a Livewire.dispatch event
Hi, I followed the Filament documentation and added an action to a Livewire component. I would like to open the modal using the Livewire.dispatch('openModal') event. Is this possible? I know the function is firing, if I put a diedump in there, it runs.
4 replies
FFilament
Created by Luukd_2000 on 8/25/2023 in #❓┊help
Recourse list, only show user made entires
Hi, I have a FreelancerCV resource. I want a freelancer to be able to create their own cv items. On the resource list page, I only want to show the entries made by that freelancer. Every FreelancerCV row in the database has a freelancer_id. How can I edit the query with ->where('freelancer_id', $freelancer_id)?
4 replies