> */ public function rules(): array { return [ 'group_1' => [ 'required_with:group_2', 'in:day,week,month,year,user,project,task,client,billable', ], 'group_2' => [ 'in:day,week,month,year,user,project,task,client,billable', ], // Filter by user ID 'user_id' => [ 'string', 'uuid', new ExistsEloquent(User::class, null, function (Builder $builder): Builder { /** @var Builder $builder */ return $builder->belongsToOrganization($this->organization); }), ], // Filter by project IDs, project IDs are OR combined 'project_ids' => [ 'array', 'min:1', ], 'project_ids.*' => [ 'string', 'uuid', new ExistsEloquent(Project::class, null, function (Builder $builder): Builder { /** @var Builder $builder */ return $builder->visibleByUser(Auth::user()); }), ], // Filter by tag IDs, tag IDs are AND combined 'tag_ids' => [ 'array', 'min:1', ], 'tag_ids.*' => [ 'string', 'uuid', new ExistsEloquent(Tag::class, null, function (Builder $builder): Builder { /** @var Builder $builder */ return $builder->whereBelongsTo($this->organization, 'organization'); }), ], // Filter by task IDs, task IDs are OR combined 'task_ids' => [ 'array', 'min:1', ], 'task_ids.*' => [ 'string', 'uuid', new ExistsEloquent(Task::class, null, function (Builder $builder): Builder { /** @var Builder $builder */ return $builder->visibleByUser(Auth::user()); }), ], // Filter only time entries that have a start date before (not including) the given date (example: 2021-12-31) 'before' => [ 'nullable', 'string', 'date_format:Y-m-d\TH:i:s\Z', 'before:after', ], // Filter only time entries that have a start date after (not including) the given date (example: 2021-12-31) 'after' => [ 'nullable', 'string', 'date_format:Y-m-d\TH:i:s\Z', ], // Filter by active status (active means has no end date, is still running) 'active' => [ 'string', 'in:true,false', ], // Filter by billable status 'billable' => [ 'string', 'in:true,false', ], ]; } }