mamamia
mamamia
FFilament
Created by mamamia on 1/24/2024 in #❓┊help
How to use array in getTableQuery instead of Builder?
Thanks im gonna try that. one last question so i have filter select for "year", how to append it to the api url as param?
4 replies
FFilament
Created by mamamia on 1/22/2024 in #❓┊help
How to mimic create action?
okay thank you so muchh for answering my question
13 replies
FFilament
Created by mamamia on 1/22/2024 in #❓┊help
How to mimic create action?
but when i dd the $data the "status_project" is not appearing, im thinking to do this one instead of mutateForm but idk if this is the best practice or nah
Action::make('create')
->label('Create')
->action(function(){
$this->authorizeAccess();

try {
$data = $this->form->getState();
$data['status_project'] = ProjectStatus::SUBMISSION;

$this->record = $this->handleRecordCreation($data);

} catch (Halt $exception) {
return;
}

})
->after(function(){
$record = $this->record;
$history = [
"project_id" => $record->id,
"start_date" => $record->start_date,
"end_date" => $record->end_date,
"responded_at" => null,
"responded_by" => null,
"submission_at" => date("Y-m-d H:i:s"),
"submission_by" => auth()->user()->id,
"submission_description" => $record->submission_description,
"submission_type" => ProjectHistorySubmission::NEW,
"status" => ProjectStatus::SUBMISSION,
];
ProjectHistory::create($history);
})
Action::make('create')
->label('Create')
->action(function(){
$this->authorizeAccess();

try {
$data = $this->form->getState();
$data['status_project'] = ProjectStatus::SUBMISSION;

$this->record = $this->handleRecordCreation($data);

} catch (Halt $exception) {
return;
}

})
->after(function(){
$record = $this->record;
$history = [
"project_id" => $record->id,
"start_date" => $record->start_date,
"end_date" => $record->end_date,
"responded_at" => null,
"responded_by" => null,
"submission_at" => date("Y-m-d H:i:s"),
"submission_by" => auth()->user()->id,
"submission_description" => $record->submission_description,
"submission_type" => ProjectHistorySubmission::NEW,
"status" => ProjectStatus::SUBMISSION,
];
ProjectHistory::create($history);
})
13 replies
FFilament
Created by mamamia on 1/22/2024 in #❓┊help
How to mimic create action?
thank you for the answer, so i have the form but there is no status_project field, because i want status_project field automatically generated. how do i do that?
13 replies
FFilament
Created by mamamia on 1/22/2024 in #❓┊help
How to mimic create action?
i tried that but somehow i didnt get status_project from the action, do you know why? here is my code
Action::make('create')
->label('Create')
->mutateFormDataUsing(function (array $data){
$data['status_project'] = ProjectStatus::SUBMISSION;
return $data;
})
->action(function(){
$this->authorizeAccess();
try {
$data = $this->form->getState();
// somehow there is not status_project inside $data
} catch (Halt $exception) {
return;
}

})
->after(function(){
$record = $this->record;
$history = [
"project_id" => $record->id,
"start_date" => $record->start_date,
"end_date" => $record->end_date,
"responded_at" => null,
"responded_by" => null,
"submission_at" => date("Y-m-d H:i:s"),
"submission_by" => auth()->user()->id,
"submission_description" => $record->submission_description,
"submission_type" => ProjectHistorySubmission::NEW,
"status" => ProjectStatus::SUBMISSION,
];
ProjectHistory::create($history);
}),
Action::make('create')
->label('Create')
->mutateFormDataUsing(function (array $data){
$data['status_project'] = ProjectStatus::SUBMISSION;
return $data;
})
->action(function(){
$this->authorizeAccess();
try {
$data = $this->form->getState();
// somehow there is not status_project inside $data
} catch (Halt $exception) {
return;
}

})
->after(function(){
$record = $this->record;
$history = [
"project_id" => $record->id,
"start_date" => $record->start_date,
"end_date" => $record->end_date,
"responded_at" => null,
"responded_by" => null,
"submission_at" => date("Y-m-d H:i:s"),
"submission_by" => auth()->user()->id,
"submission_description" => $record->submission_description,
"submission_type" => ProjectHistorySubmission::NEW,
"status" => ProjectStatus::SUBMISSION,
];
ProjectHistory::create($history);
}),
13 replies
FFilament
Created by mamamia on 1/22/2024 in #❓┊help
Visible On Edit
Awesome! it worked perfectly
8 replies
FFilament
Created by mamamia on 1/22/2024 in #❓┊help
Visible On Edit
thank you for your answer but when i tried it "visible" is not working when there is "visibleOn", so how do i know its on edit inside "visible"?
8 replies