How can I get the $event->id clicked in the calendar?
I want to upload files according to $event->id, but I can't move forward.
https://github.com/saade/filament-fullcalendar#returning-events
protected function headerActions(): array
{
return [
CreateAction::make()
->before(function (CreateAction $action, Task $task ) {
$controlTask = $task
->where('company_id', Auth::user()->company_id)
->whereNull('user_file')
->where('task_end_date', '>', now())->first();
if ($controlTask) {
$action->cancel();
}
})
->model(Task::class)
->form([
FileUpload::make('user_file')
->required()
->label('Kullanıcı Dosya Yükle')->multiple(),
])
->using(function (array $data, string $model): Task {
Task::where('company_id', Auth::user()->company_id)->update(['user_file' => $data['user_file']]);
return $model::create($data);
})
];
}
public function fetchEvents(array $fetchInfo): array
{
$data = Task::query()
->where('created_at', '>=', $fetchInfo['start'])
->where('task_end_date', '<=', $fetchInfo['end'])
->where('company_id', Auth::user()->company_id)
->get()
->map(
fn(Task $event) => EventData::make()
->id($event->id)
->title(__('custom.' . $event->document_type))
->textColor('yellow')
->start($event->created_at)
->end($event->task_end_date)
->url(
url: BoughtProductResource::getUrl(),
)
)->toArray();
return $data;
}
protected function headerActions(): array
{
return [
CreateAction::make()
->before(function (CreateAction $action, Task $task ) {
$controlTask = $task
->where('company_id', Auth::user()->company_id)
->whereNull('user_file')
->where('task_end_date', '>', now())->first();
if ($controlTask) {
$action->cancel();
}
})
->model(Task::class)
->form([
FileUpload::make('user_file')
->required()
->label('Kullanıcı Dosya Yükle')->multiple(),
])
->using(function (array $data, string $model): Task {
Task::where('company_id', Auth::user()->company_id)->update(['user_file' => $data['user_file']]);
return $model::create($data);
})
];
}
public function fetchEvents(array $fetchInfo): array
{
$data = Task::query()
->where('created_at', '>=', $fetchInfo['start'])
->where('task_end_date', '<=', $fetchInfo['end'])
->where('company_id', Auth::user()->company_id)
->get()
->map(
fn(Task $event) => EventData::make()
->id($event->id)
->title(__('custom.' . $event->document_type))
->textColor('yellow')
->start($event->created_at)
->end($event->task_end_date)
->url(
url: BoughtProductResource::getUrl(),
)
)->toArray();
return $data;
}
GitHub
GitHub - saade/filament-fullcalendar: The Most Popular JavaScript C...
The Most Popular JavaScript Calendar as a Filament Widget - saade/filament-fullcalendar
1 Reply