paginate($sql, $params); } public function create(array $data): array { $stmt = $this->db->prepare( 'INSERT INTO players (team_id, first_name, last_name, document_id, birth_date, jersey_number, position, photo_path) VALUES (:team_id, :first_name, :last_name, :document_id, :birth_date, :jersey_number, :position, :photo_path)' ); $stmt->execute([ 'team_id' => $data['team_id'], 'first_name' => $data['first_name'], 'last_name' => $data['last_name'], 'document_id' => $data['document_id'], 'birth_date' => $data['birth_date'] ?? null, 'jersey_number' => $data['jersey_number'] ?? null, 'position' => $data['position'] ?? null, 'photo_path' => $data['photo_path'] ?? null, ]); $id = (int) $this->db->lastInsertId(); $stmt = $this->db->prepare('SELECT * FROM players WHERE id = :id'); $stmt->execute(['id' => $id]); return $stmt->fetch(); } }