Zen Nitiruj
Zen Nitiruj
FFilament
Created by Zen Nitiruj on 10/19/2024 in #❓┊help
In RelationshipManager modal form, how I can validate Repeater form
Please advise how I make a proper livewire->validate() the Repeater Data form. The data is in array as $data['transfer'] . At the moment I just made if(!blank($transferData['from_id']) ... I would like to use $livewire->validate( 'to_id'=>['required'], ) but how to put Repeater in to validate
->headerActions([
->action(function ($data, RelationManager $livewire) {
if ($data['transfers']) {
$employee = $livewire->getOwnerRecord();
foreach ($data['transfers'] as $transfer) {
if (!$livewire->validateForm($data, $transfer)) return;
$newRecord = new Transfer();
$newRecord->from_id = $transfer['from_id'];
$newRecord->to_id = $transfer['to_id'];
$newRecord->transfer_type = $transfer['transfer_type'];
$newRecord->employee_id = $livewire->getOwnerRecord()->id;
$newRecord->transfer_date = $data['transfer_date'];
$newRecord->effective_date = $data['effective_date'];
$newRecord->before_detail = EmployeeResource::getEmploymentDetail($livewire->getOwnerRecord());
$records[] = $newRecord;
$fieldId = strtolower(Str::snake(class_basename($transfer['transfer_type']))) . '_id';
$employee->$fieldId = $transfer['to_id'];
}
$livewire->updateAfterDetail($records, $employee);
$employee->save();

}
})
->headerActions([
->action(function ($data, RelationManager $livewire) {
if ($data['transfers']) {
$employee = $livewire->getOwnerRecord();
foreach ($data['transfers'] as $transfer) {
if (!$livewire->validateForm($data, $transfer)) return;
$newRecord = new Transfer();
$newRecord->from_id = $transfer['from_id'];
$newRecord->to_id = $transfer['to_id'];
$newRecord->transfer_type = $transfer['transfer_type'];
$newRecord->employee_id = $livewire->getOwnerRecord()->id;
$newRecord->transfer_date = $data['transfer_date'];
$newRecord->effective_date = $data['effective_date'];
$newRecord->before_detail = EmployeeResource::getEmploymentDetail($livewire->getOwnerRecord());
$records[] = $newRecord;
$fieldId = strtolower(Str::snake(class_basename($transfer['transfer_type']))) . '_id';
$employee->$fieldId = $transfer['to_id'];
}
$livewire->updateAfterDetail($records, $employee);
$employee->save();

}
})
2 replies
FFilament
Created by Zen Nitiruj on 10/16/2024 in #❓┊help
I suddenly got issue on Repeater after running composer update
No description
9 replies
FFilament
Created by Zen Nitiruj on 8/30/2024 in #❓┊help
How to override all ViewRecord pages getView() function
I'm make a trait to get simple set $view file of page view to my custom view file.
namespace App\Filament\Concerns;

use Filament\Resources\Pages\EditRecord;
use Filament\Resources\Pages\ViewRecord;


trait FastRelationManagerTab
{
public function getView(): string
{
if ($this instanceof EditRecord) {
return 'filament.resources.edit-record';
} elseif ($this instanceof ViewRecord) {
return 'filament.resources.view-record';
} else {
return parent::$view;
}
}
}
namespace App\Filament\Concerns;

use Filament\Resources\Pages\EditRecord;
use Filament\Resources\Pages\ViewRecord;


trait FastRelationManagerTab
{
public function getView(): string
{
if ($this instanceof EditRecord) {
return 'filament.resources.edit-record';
} elseif ($this instanceof ViewRecord) {
return 'filament.resources.view-record';
} else {
return parent::$view;
}
}
}
I wonder that If I want to set to all ViewRecord pages, how I can do so. I wish I can do on ServiceProvider, Please advise, I want to set view file something like 'filament.resources.view-record'
4 replies
FFilament
Created by Zen Nitiruj on 8/29/2024 in #❓┊help
Relationship Manager AttachAction custom form
No description
4 replies
FFilament
Created by Zen Nitiruj on 8/23/2024 in #❓┊help
TableWidget using Resource Table but View does not got to view page
No description
2 replies
FFilament
Created by Zen Nitiruj on 8/6/2024 in #❓┊help
I am using Api Service plugin, but don't know how to make validate token
Please give some sample how I make handle for Api authentication using Api Serivice plugin. I understand that it uses Sanctum, but I am so new on this. How to call with bearer token etc. I don't see this in the document. #rupadana-api-service
6 replies
FFilament
Created by Zen Nitiruj on 6/18/2024 in #❓┊help
How to use Repeater in RelationManager form with MorpTo model
No description
2 replies
FFilament
Created by Zen Nitiruj on 6/15/2024 in #❓┊help
How to group table list by one to many relationship field
No description
2 replies
FFilament
Created by Zen Nitiruj on 6/10/2024 in #❓┊help
How to make Table widget with merge 2 sources of data
I m trying to create a widget of summary income expenses. But incomes could come from 2 models 2 tables with different table structures. I want to create a new custom table to list daily incomes from 2 database tables in one Table widget with date sorting. Please advise how I make $table->query for this. php public function table(Table $table): Table { return $table ->query( fn (Builder $query) => $query->where('user_id', auth()->id()) ->orderByDesc('created_at') ->limit(5) ) ->columns([ // ... ]); }
2 replies
FFilament
Created by Zen Nitiruj on 6/7/2024 in #❓┊help
Form does not display filled data.
No description
7 replies
FFilament
Created by Zen Nitiruj on 5/28/2024 in #❓┊help
Livewire modal does not pop to top layer
No description
5 replies
FFilament
Created by Zen Nitiruj on 5/24/2024 in #❓┊help
How to load page in SPA after Modal Action
No description
2 replies
FFilament
Created by Zen Nitiruj on 5/22/2024 in #❓┊help
Is there anyway to reload RelationManager Owner page with Spa mode?
No description
8 replies
FFilament
Created by Zen Nitiruj on 5/20/2024 in #❓┊help
I try to seed using has function for relationship but does not create child record.
I can propertyServices separately, it works. I wonder what I made wrong on using has in PropertySeeder #factory #seeder
7 replies
FFilament
Created by Zen Nitiruj on 5/20/2024 in #❓┊help
Form does not revalidate after change value
I have set unique(ignoreRecord:true), when it to validate with red message the submit button is also disabled. The problem is even I have change the value of the field to unique value, but the validation does not recheck and submit button is still disabled. Please advise how I could cope this.
5 replies
FFilament
Created by Zen Nitiruj on 5/20/2024 in #❓┊help
How modify rule for unique() when it must be unique if another field eg group are the same?
I have a house that belongs to a villege. In the same villege house_no must be unique but in different villege house_no can be the same. I tried to use ->unique( modifyRuleUsing: fn() =>...) but I don't know how to set this up. Please advise. #unique #✅┊rules
4 replies
FFilament
Created by Zen Nitiruj on 5/9/2024 in #❓┊help
css has preload warning aftter adding to ApplServiceProvider with hook. How to fix this?
No description
2 replies
FFilament
Created by Zen Nitiruj on 5/4/2024 in #❓┊help
Working fine in local environment but fail on server
No description
10 replies
FFilament
Created by Zen Nitiruj on 5/3/2024 in #❓┊help
How I can enable the Relation Manager Action in view mode?
No description
5 replies
FFilament
Created by Zen Nitiruj on 4/28/2024 in #❓┊help
Having issues with spa() and https and logout
When put URL::forceScheme('https') in boot() in AppServiceProvider, my panel spa() does not work. But when I remove URL::forceScheme('https') I cannot click Logout. It returns The GET method is not supported for route admin/logout. Supported methods: POST. I found that the logout function send http:// instead so it does not work with https url. Please advise how I can handdle the logout function to work, so I can remove URL::forceSechema('https') #logout #spa #https
2 replies