user() !== null; } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { /** @var Project $project */ $project = $this->route('project'); $projectTemplateId = $project->project_template_id; $ownershipColumn = $projectTemplateId === null ? 'project_id' : 'project_template_id'; $ownershipValue = $projectTemplateId ?? $project->id; return [ 'board_column_id' => [ 'nullable', 'integer', Rule::exists('board_columns', 'id')->where( fn ($query) => $query->where($ownershipColumn, $ownershipValue), ), ], 'name' => ['required', 'string', 'max:255'], ]; } }