model.tableName is set at model instanciation
Use tableName instead of table(name)